mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-07 00:18:25 +08:00
Fixed additional regression in number formatting
Related to https://github.com/yiisoft/yii2/issues/16934
This commit is contained in:
@ -1797,6 +1797,7 @@ class Formatter extends Component
|
|||||||
return !(
|
return !(
|
||||||
(string) $normalizedValue === (string) $value
|
(string) $normalizedValue === (string) $value
|
||||||
|| (string) $normalizedValue === (string)((int) $value)
|
|| (string) $normalizedValue === (string)((int) $value)
|
||||||
|
|| (string) $normalizedValue === trim((string) $value, '0')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -296,6 +296,7 @@ class FormatterNumberTest extends TestCase
|
|||||||
$this->formatter->locale = 'en-US';
|
$this->formatter->locale = 'en-US';
|
||||||
$this->assertSame('$123.00', $this->formatter->asCurrency('123'));
|
$this->assertSame('$123.00', $this->formatter->asCurrency('123'));
|
||||||
$this->assertSame('$123.00', $this->formatter->asCurrency('123.00'));
|
$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('$123,456.00', $this->formatter->asCurrency('123456'));
|
||||||
$this->assertSame('$0.00', $this->formatter->asCurrency('0'));
|
$this->assertSame('$0.00', $this->formatter->asCurrency('0'));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user