-
Notifications
You must be signed in to change notification settings - Fork 603
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Currency formatter failing for JPY #565
Comments
In this case, setting both maximumFractionDigits and minimumFractionDigits fixes the problem. Should this still be an issue? |
Also, for what it's worth, I tried this on a few currencies before I stumbled upon the problem. Its not an issue with USD, GBP, EUR, INR. I tried all of these and the formatter worked, but broke with JPY. |
Will get back to it when I have more time, but for the record I think it's related to the fact that the rules for the JPY currency modifies the |
This fixes a bug when setting the `minimumFractionDigits` or `maximumFractionDigits` options for number patterns that contain no fraction digits, such as for JPY and other currencies without fraction digits, which currently results in the error E_PAR_OUT_OF_RANGE. The primary use case is for products that don't use fraction digits in their prices for any currency (e.g. $99, £59, 99 €, ¥12,000) and consistently set `maximumFractionDigits: 0`. Currencies affected: ADP, AFN, ALL, AMD, BIF, BYR, CLP, COP, DJF, ESP, GNF, GYD, IDR, IQD, IRR, ISK, ITL, JPY, KMF, KPW, KRW, LAK, LBP, LUF, MGA, MGF, MMK, MNT, MRO, MUR, PKR, PYG, RSD, RWF, SLL, SOS, STD, SYP, TMM, TRL, TZS, UGX, UZS, UYI, VND, VUV, XAF, XOF, XPF, YER, ZMK, ZWD Fixes globalizejs#472 Fixes globalizejs#565
This fixes a bug when setting the `minimumFractionDigits` or `maximumFractionDigits` options for number patterns that contain no fraction digits, such as for JPY and other currencies without fraction digits, which currently results in the error E_PAR_OUT_OF_RANGE. The primary use case is for products that don't use fraction digits in their prices for any currency (e.g. $99, £59, 99 €, ¥12,000) and consistently set `maximumFractionDigits: 0`. Currencies affected: ADP, AFN, ALL, AMD, BIF, BYR, CLP, COP, DJF, ESP, GNF, GYD, IDR, IQD, IRR, ISK, ITL, JPY, KMF, KPW, KRW, LAK, LBP, LUF, MGA, MGF, MMK, MNT, MRO, MUR, PKR, PYG, RSD, RWF, SLL, SOS, STD, SYP, TMM, TRL, TZS, UGX, UZS, UYI, VND, VUV, XAF, XOF, XPF, YER, ZMK, ZWD Fixes #472 Fixes #565
Here is the currencyFormatter that is failing -
Globalize.currencyFormatter ( "JPY" , { maximumFractionDigits : 2 } );
Uncaught minimumFractionDigits: E_PAR_OUT_OF_RANGE: Parameter
minimumFractionDigits
has valueNaN
out of range [0, 20].createError @ app.js:8204However, the following call -
Globalize.currencyFormatter ( "JPY" );
results in no errors.
It seems like setting maximumFractionDigits for JPY causes the following error by wiping out other properties that should have default values
The text was updated successfully, but these errors were encountered: