parent
b4b51b9d46
commit
e95c604084
|
@ -348,13 +348,13 @@ abstract class ApplicationBootstrap
|
||||||
*/
|
*/
|
||||||
protected function setupTimezone()
|
protected function setupTimezone()
|
||||||
{
|
{
|
||||||
$tz = $this->config->global->get('timezone', 'UTC');
|
$timeZoneString = $this->config->global->get('timezone', 'UTC');
|
||||||
try {
|
try {
|
||||||
$tz = new DateTimeZone($tz);
|
$tz = new DateTimeZone($timeZoneString);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
throw new ConfigurationError(t('Invalid timezone') . ' "' . $tz . '"');
|
throw new ConfigurationError(t('Invalid timezone') . ' "' . $timeZoneString . '"');
|
||||||
}
|
}
|
||||||
date_default_timezone_set($tz);
|
date_default_timezone_set($timeZoneString);
|
||||||
DateTimeFactory::setConfig(array('timezone' => $tz));
|
DateTimeFactory::setConfig(array('timezone' => $tz));
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ class DateTimeFactory implements ConfigAwareFactory
|
||||||
*/
|
*/
|
||||||
public static function setConfig($config)
|
public static function setConfig($config)
|
||||||
{
|
{
|
||||||
if (!array_key_exists('timezome', $config)) {
|
if (!array_key_exists('timezone', $config)) {
|
||||||
throw new ConfigurationError(t('"DateTimeFactory" expects a valid time zone to be set via "setConfig"'));
|
throw new ConfigurationError(t('"DateTimeFactory" expects a valid time zone to be set via "setConfig"'));
|
||||||
}
|
}
|
||||||
self::$timeZone = $config['timezone'];
|
self::$timeZone = $config['timezone'];
|
||||||
|
|
Loading…
Reference in New Issue