Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

Commit

Permalink
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/View/Helper/DateFormat.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public function __invoke(
}

$timezone = $this->getTimezone();
$formatterId = md5($dateType . "\0" . $timeType . "\0" . $locale);
$formatterId = md5($dateType . "\0" . $timeType . "\0" . $locale ."\0" . $pattern);

if (!isset($this->formatters[$formatterId])) {
$this->formatters[$formatterId] = new IntlDateFormatter(
Expand Down
10 changes: 10 additions & 0 deletions test/View/Helper/DateFormatTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,16 @@ public function testDefaultLocale()
{
$this->assertEquals(Locale::getDefault(), $this->helper->getLocale());
}

public function testBugTwoPatternOnSameHelperInstance()
{
$date = new DateTime('2012-07-02T22:44:03Z');

$helper = new DateFormatHelper();
$helper->setTimezone('Europe/Berlin');
$this->assertEquals('03/2012', $helper->__invoke($date, null, null, 'it_IT', 'dd/Y'));
$this->assertEquals('03-2012', $helper->__invoke($date, null, null, 'it_IT', 'dd-Y'));
}

public function assertMbStringEquals($expected, $test, $message = '')
{
Expand Down

0 comments on commit 73371d0

Please sign in to comment.