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

E_PAR_OUT_OF_RANGE: Parameter `minimumFractionDigits` has value `NaN` out of range [0, 20]. #472

Closed
dpolivy opened this Issue Jul 25, 2015 · 1 comment

Comments

Projects
None yet
2 participants
@dpolivy

dpolivy commented Jul 25, 2015

Locale: ja-JP
Currency Code: JPY

Calling currencyFormatter with the following as options results in the exception in the title:

    {
        maximumFractionDigits: 0
    }

It seems that in this case, the logic at this line might not be correct? minimumFractionDigits is undefined, and persists that way.
https://github.com/jquery/globalize/blob/master/src/number/format-properties.js#L81

I haven't had time to dig in more to see if this is a data, cldrjs, or code issue, but hopefully it's an easy fix.

This is blocking Japanese users on our site as it just blows up trying to format currency.

@rxaviers

This comment has been minimized.

Show comment
Hide comment
@rxaviers

rxaviers Aug 7, 2015

Member

Note to self: the root cause is minimumFractionDigits not being initialized when the number raw pattern has no decimal part, e.g., {raw: "0"}.

PS: Specifically, the JPY currency (independently of the used locale) has no decimal digits. Therefore, it uses a number pattern with no such part.

Member

rxaviers commented Aug 7, 2015

Note to self: the root cause is minimumFractionDigits not being initialized when the number raw pattern has no decimal part, e.g., {raw: "0"}.

PS: Specifically, the JPY currency (independently of the used locale) has no decimal digits. Therefore, it uses a number pattern with no such part.

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