mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-13 19:06:40 +00:00
Support of negative timestamps
This commit is contained in:
@@ -237,7 +237,10 @@ function twig_cycle($values, $i)
|
||||
function twig_date_format_filter($date, $format = 'F j, Y H:i', $timezone = null)
|
||||
{
|
||||
if (!$date instanceof DateTime && !$date instanceof DateInterval) {
|
||||
if (ctype_digit((string) $date)) {
|
||||
if (ctype_digit((string) $date)
|
||||
|| (('-' == $date[0])
|
||||
&& (ctype_digit(substr($date, 1))))
|
||||
) {
|
||||
$date = new DateTime('@'.$date);
|
||||
$date->setTimezone(new DateTimeZone(date_default_timezone_get()));
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user