Fixed the handling of the timezone for DateTime objects
authorChristophe Coevoet <stof@notk.org>
Thu, 3 May 2012 20:25:04 +0000 (22:25 +0200)
committerChristophe Coevoet <stof@notk.org>
Thu, 3 May 2012 20:25:04 +0000 (22:25 +0200)
lib/Twig/Extension/Core.php

index 301c4bb..37415ae 100644 (file)
@@ -388,6 +388,7 @@ function twig_date_format_filter(Twig_Environment $env, $date, $format = null, $
 
     if ($date instanceof DateInterval || $date instanceof DateTime) {
         if (null !== $timezone) {
+            $date = clone $date;
             $date->setTimezone($timezone instanceof DateTimeZone ? $timezone : new DateTimeZone($timezone));
         }