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

@ -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;