mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-13 10:56:38 +00:00
fixed timezone when using the date filter with a UNIX timestamp (it now uses the default timezone instead of UTC to mimics the date() function behavior)
This commit is contained in:
@@ -203,7 +203,12 @@ class Twig_Extension_Core extends Twig_Extension
|
||||
function twig_date_format_filter($date, $format = 'F j, Y H:i')
|
||||
{
|
||||
if (!$date instanceof DateTime) {
|
||||
$date = new DateTime((ctype_digit((string) $date) ? '@' : '').$date);
|
||||
if (ctype_digit((string) $date)) {
|
||||
$date = new DateTime('@'.$date);
|
||||
$date->setTimezone(new DateTimeZone(date_default_timezone_get()));
|
||||
} else {
|
||||
$date = new DateTime($date);
|
||||
}
|
||||
}
|
||||
|
||||
return $date->format($format);
|
||||
|
||||
Reference in New Issue
Block a user