{
protected $dateFormats = array('F j, Y H:i', '%d days');
protected $numberFormat = array(0, '.', ',');
+ protected $timezone = null;
/**
* Sets the default format to be used by the date filter.
}
/**
+ * Sets the default timezone to be used by the date filter.
+ *
+ * @param DateTimeZone|string $timezone The default timezone string or a DateTimeZone object
+ */
+ public function setTimezone($timezone)
+ {
+ if ($timezone instanceof DateTimeZone) {
+ $this->timezone = $timezone;
+ } else {
+ $this->timezone = new DateTimeZone($timezone);
+ }
+ }
+
+ /**
+ * Gets the default timezone to be used by the date filter.
+ *
+ * @return DateTimeZone The default timezone currently in use
+ */
+ public function getTimezone()
+ {
+ return $this->timezone;
+ }
+
+ /**
* Sets the default format to be used by the number_format filter.
*
* @param integer $decimal The number of decimal places to use.
$date->setTimezone($timezone);
}
+ else if (($timezone = $env->getExtension('core')->getTimezone()) instanceof DateTimeZone)
+ {
+ $date->setTimezone($timezone);
+ }
return $date->format($format);
}