Skip to content

Commit

Permalink
[Form] Fix failing MonthChoiceList in PHP 5.5
Browse files Browse the repository at this point in the history
  • Loading branch information
stloyd committed Jan 4, 2013
1 parent f4ce2f1 commit 8ae773b
Showing 1 changed file with 10 additions and 2 deletions.
Expand Up @@ -39,7 +39,11 @@ protected function load()
$pattern = $this->formatter->getPattern();
$timezone = $this->formatter->getTimezoneId();

$this->formatter->setTimezoneId('UTC');
if (version_compare(phpversion(), '5.5.0alpha1', '<')) {
$this->formatter->setTimezoneId('UTC');
} else {
$this->formatter->setTimezone('UTC');
}

if (preg_match('/M+/', $pattern, $matches)) {
$this->formatter->setPattern($matches[0]);
Expand All @@ -53,6 +57,10 @@ protected function load()
$this->formatter->setPattern($pattern);
}

$this->formatter->setTimezoneId($timezone);
if (version_compare(phpversion(), '5.5.0alpha1', '<')) {
$this->formatter->setTimezoneId($timezone);
} else {
$this->formatter->setTimezone($timezone);
}
}
}

0 comments on commit 8ae773b

Please sign in to comment.