Added Capability to format DateInterval via twig date filter
authorphiamo <phiamo@gmail.com>
Thu, 29 Sep 2011 00:44:55 +0000 (02:44 +0200)
committerphiamo <phiamo@gmail.com>
Thu, 29 Sep 2011 00:44:55 +0000 (02:44 +0200)
lib/Twig/Extension/Core.php

index 8265394..6ca8331 100644 (file)
@@ -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()));