diff --git a/framework/i18n/Formatter.php b/framework/i18n/Formatter.php index b2b2615865..3c59242c86 100644 --- a/framework/i18n/Formatter.php +++ b/framework/i18n/Formatter.php @@ -1797,6 +1797,7 @@ class Formatter extends Component return !( (string) $normalizedValue === (string) $value || (string) $normalizedValue === (string)((int) $value) + || (string) $normalizedValue === trim((string) $value, '0') ); } diff --git a/tests/framework/i18n/FormatterNumberTest.php b/tests/framework/i18n/FormatterNumberTest.php index 6b60de1f68..eb10f691a3 100644 --- a/tests/framework/i18n/FormatterNumberTest.php +++ b/tests/framework/i18n/FormatterNumberTest.php @@ -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'));