Fixed additional regression in number formatting

Related to https://github.com/yiisoft/yii2/issues/16934
This commit is contained in:
SilverFire - Dmitry Naumenko
2018-12-06 17:35:22 +02:00
parent bca1e88fbd
commit 4d3a140482
2 changed files with 2 additions and 0 deletions

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')
);
}

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'));