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

Closed
cahuja opened this Issue Dec 8, 2015 · 3 comments

Comments

Projects
None yet
2 participants
@cahuja

cahuja commented Dec 8, 2015

Here is the currencyFormatter that is failing -
Globalize.currencyFormatter ( "JPY" , { maximumFractionDigits : 2 } );

Uncaught minimumFractionDigits: E_PAR_OUT_OF_RANGE: Parameter minimumFractionDigits has value NaN out of range [0, 20].createError @ app.js:8204

However, 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

@cahuja

This comment has been minimized.

Show comment
Hide comment
@cahuja

cahuja Dec 8, 2015

In this case, setting both maximumFractionDigits and minimumFractionDigits fixes the problem. Should this still be an issue?

cahuja commented Dec 8, 2015

In this case, setting both maximumFractionDigits and minimumFractionDigits fixes the problem. Should this still be an issue?

@cahuja

This comment has been minimized.

Show comment
Hide comment
@cahuja

cahuja Dec 8, 2015

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.

cahuja commented Dec 8, 2015

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.

@rxaviers

This comment has been minimized.

Show comment
Hide comment
@rxaviers

rxaviers Dec 8, 2015

Member

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 maximumFractionDigits and minimumFractionDigits to 0.

Member

rxaviers commented Dec 8, 2015

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 maximumFractionDigits and minimumFractionDigits to 0.

patch added a commit to patch/globalize that referenced this issue Jul 9, 2017

Number: Fix fraction digit options for patterns with no fraction digits
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

@rxaviers rxaviers closed this in #757 Dec 1, 2017

rxaviers added a commit that referenced this issue Dec 1, 2017

Number: Fix fraction digit options for patterns with no fraction digits
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment