From: phiamo Date: Thu, 29 Sep 2011 00:44:55 +0000 (+0200) Subject: Added Capability to format DateInterval via twig date filter X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=5fa00942ddb62337a008a1a040e2eabe37215b6d;p=web%2Fkonrad%2Ftwig.git Added Capability to format DateInterval via twig date filter --- diff --git a/lib/Twig/Extension/Core.php b/lib/Twig/Extension/Core.php index 8265394..6ca8331 100644 --- a/lib/Twig/Extension/Core.php +++ b/lib/Twig/Extension/Core.php @@ -221,7 +221,7 @@ function twig_cycle($values, $i) */ function twig_date_format_filter($date, $format = 'F j, Y H:i', $timezone = null) { - if (!$date instanceof DateTime) { + if (!$date instanceof DateTime && !$date instanceof DateInterval) { if (ctype_digit((string) $date)) { $date = new DateTime('@'.$date); $date->setTimezone(new DateTimeZone(date_default_timezone_get()));