Commits
-------
5699753 added setTimezone to allow globally overriding the timezone when formating dates
Discussion
----------
Allow setting global timezone for date formatting
My API returns dates in a string format of 2012-02-14T00:35:37+00:00. When parsed by the DateTime constructor, the timezone for that new object is UTC. Without specifying every time I use the date filter there was no way to globally influence the timezone used.
I added setTimezone() to the core extension that functions similar to setDateFormat() except that there is no timezone set by default to allow for backwards compatibility.
$date->setTimezone($timezone);
}
+ else if (($timezone = $env->getExtension('core')->getTimezone()) instanceof DateTimeZone)
+ {
+ $date->setTimezone($timezone);
+ }
- return $date->format($format);
+ return $date;
}
/**