mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-15 11:56:50 +00:00
fixed the conversion of the special '0000-00-00 00:00' date
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
* 1.15.1 (2013-XX-XX)
|
||||
|
||||
* fixed the conversion of the special '0000-00-00 00:00' date
|
||||
* added an error message when trying to import an undefined block from a trait
|
||||
|
||||
* 1.15.0 (2013-12-06)
|
||||
|
||||
@@ -504,15 +504,18 @@ function twig_date_converter(Twig_Environment $env, $date = null, $timezone = nu
|
||||
$defaultTimezone = $timezone;
|
||||
}
|
||||
|
||||
// immutable dates
|
||||
if ($date instanceof DateTimeImmutable) {
|
||||
return false !== $timezone ? $date->setTimezone($defaultTimezone) : $date;
|
||||
}
|
||||
|
||||
if ($date instanceof DateTime || $date instanceof DateTimeInterface) {
|
||||
$returningDate = new DateTime($date->format('c'));
|
||||
$date = clone $date;
|
||||
if (false !== $timezone) {
|
||||
$returningDate->setTimezone($defaultTimezone);
|
||||
} else {
|
||||
$returningDate->setTimezone($date->getTimezone());
|
||||
$date->setTimezone($defaultTimezone);
|
||||
}
|
||||
|
||||
return $returningDate;
|
||||
return $date;
|
||||
}
|
||||
|
||||
$asString = (string) $date;
|
||||
|
||||
Reference in New Issue
Block a user