You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In this use case, I'm formatting a sum of money to three (3) significant figures using MoneyFormatter::formatShort(decimals: -3). However, if that sum is 0, the formatter fails with a simple IntlException: Constructor failed.
Adding a simple check, such as $sum > 0 ? -3 : 2 fixes the problem, but is unsightly and clunky. I think a built-in implementation could be worth it.
Steps to Reproduce
PHP v8.3 Laravel v11.35.1 Filament v3.2.130 Package dev-main, but it also occurs on v1.4.3
No changes were made to the configuration files.
The reason I'm on dev-main is because MoneyFormatter::formatShort() on v1.4.3 doesn't work as intended since the decimals argument wasn't getting pass through properly, but that got fixed in 475aa78.
Thanks for reporting.
I will look into this. I will take some time to address all open issues during next week and hopefully get close to a version 2.0 release.
Description
In this use case, I'm formatting a sum of money to three (3) significant figures using
MoneyFormatter::formatShort(decimals: -3)
. However, if that sum is 0, the formatter fails with a simpleIntlException: Constructor failed
.Adding a simple check, such as
$sum > 0 ? -3 : 2
fixes the problem, but is unsightly and clunky. I think a built-in implementation could be worth it.Steps to Reproduce
PHP v8.3
Laravel v11.35.1
Filament v3.2.130
Package dev-main, but it also occurs on v1.4.3
No changes were made to the configuration files.
The reason I'm on
dev-main
is becauseMoneyFormatter::formatShort()
onv1.4.3
doesn't work as intended since the decimals argument wasn't getting pass through properly, but that got fixed in 475aa78.Relevant Code
Expected Behavior
I'm not sure of the exact return value, but in the case of
-3
precision, I think it should return0.00
if the value is 0.The text was updated successfully, but these errors were encountered: