Fix timezone problem

This commit is contained in:
Némunaire 2015-01-18 12:10:52 +01:00 committed by Nemunaire
commit 603f7bb72e
2 changed files with 4 additions and 3 deletions

View file

@ -43,6 +43,7 @@ function smarty_modifier_date_format($string, $format = null, $default_date = ''
} else {
return;
}
$timestamp += 3600;
if ($formatter == 'strftime' || ($formatter == 'auto' && strpos($format, '%') !== false)) {
if (DS == '\\') {
$_win_from = array('%D', '%h', '%n', '%r', '%R', '%t', '%T');

View file

@ -20,7 +20,7 @@ function smarty_make_timestamp($string)
{
if (empty($string)) {
// use "now":
return time();
return localtime();
} elseif ($string instanceof DateTime) {
return $string->getTimestamp();
} elseif (strlen($string) == 14 && ctype_digit($string)) {
@ -29,13 +29,13 @@ function smarty_make_timestamp($string)
substr($string, 4, 2), substr($string, 6, 2), substr($string, 0, 4));
} elseif (is_numeric($string)) {
// it is a numeric string, we handle it as timestamp
return (int) $string;
return localtime($string);
} else {
// strtotime should handle it
$time = strtotime($string);
if ($time == - 1 || $time === false) {
// strtotime() was not able to parse $string, use "now":
return time();
return localtime();
}
return $time;