Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Support of negative timestamps

  • Loading branch information...
commit a4a2d6f7634da18351e5ab6db7ac7ea5bedd631f 1 parent 1b32617
@shvchk authored
Showing with 4 additions and 1 deletion.
  1. +4 −1 lib/Twig/Extension/Core.php
View
5 lib/Twig/Extension/Core.php
@@ -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 {
Please sign in to comment.
Something went wrong with that request. Please try again.