Fixed additional regression in number formatting

Related to https://github.com/yiisoft/yii2/issues/16934
This commit is contained in:
octicon-git-branch(16/)
octicon-tag(16/)
SilverFire - Dmitry Naumenko
2018-12-06 17:35:22 +02:00
gitea-unlock(16/)
parent bca1e88fbd
commit 4d3a140482
octicon-diff(16/tw-mr-1) 2 changed files with 2 additions and 0 deletions

1
framework/i18n/Formatter.php
View File

@@ -1797,6 +1797,7 @@ class Formatter extends Component
return !(
(string) $normalizedValue === (string) $value
|| (string) $normalizedValue === (string)((int) $value)
|| (string) $normalizedValue === trim((string) $value, '0')
);
}

1
tests/framework/i18n/FormatterNumberTest.php
View File

@@ -296,6 +296,7 @@ class FormatterNumberTest extends TestCase
$this->formatter->locale = 'en-US';
$this->assertSame('$123.00', $this->formatter->asCurrency('123'));
$this->assertSame('$123.00', $this->formatter->asCurrency('123.00'));
$this->assertSame('$123.20', $this->formatter->asCurrency('123.20'));
$this->assertSame('$123,456.00', $this->formatter->asCurrency('123456'));
$this->assertSame('$0.00', $this->formatter->asCurrency('0'));