Closed Bug 866372 Opened 11 years ago Closed 9 years ago

Currency formatting with currencyDisplay="name" results in error

Categories

(Core :: JavaScript Engine, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 1093421

People

(Reporter: mozillabugs, Unassigned)

References

Details

Intl.NumberFormat.prototype.format throws an error when asked to format a currency value with currencyDisplay="name":

js> print(new Intl.NumberFormat("en-US", {style: "currency", currency: "USD", currencyDisplay: "name"}).format(0))
typein:1:0 Error: internal error while computing Intl data
Calling unum_open with the style parameter set to UNUM_CURRENCY_ISO or UNUM_CURRENCY_PLURAL returns status U_UNSUPPORTED_ERROR.

In the API spec, both are listed as normal values of the parameter type UNumberFormatStyle, but then are not listed as possible values for unum_open. In the implementation, they are not supported in the big case statement in the implementation.
http://icu-project.org/apiref/icu4c/unum_8h.html#a4eb4d3ff13bd506e7078b2be4052266d
http://icu-project.org/apiref/icu4c/unum_8h.html#a581f9eb53d6b1b052b751272e1c6b67f
http://bugs.icu-project.org/trac/browser/icu/trunk/source/i18n/unum.cpp#L49

Sent inquiry to icu-support@lists.sourceforge.net.
Adding the two constants to the switch statement seems to fix the problem.

Filed ICU ticket:
http://bugs.icu-project.org/trac/ticket/10135
The ICU bug has been fixed for ICU 53, although under a different ticket:
http://bugs.icu-project.org/trac/ticket/10676

Change sets:
http://bugs.icu-project.org/trac/review/10676
Assignee: general → nobody
In latest Firefox (33.0.2), I get the error for currencyDisplay = "name" as well as "code" (!).

Why isn't it fixed? Does Firefox use an old ICU version?
Still same error as in the last comment in Firefox 37.0.1.
Depends on: 992079, 1075758
I am getting same error. 
1222221.0.toLocaleString("NL-en", {style: 'currency', currency: 'EUR', currencyDisplay: 'code', minimumFractionDigits:2, maximumFractionDigits:2})

When i used this funtion in my angular filter, its giving meta data like {{model.modelValue | CustomCurrency:model.currencyData}} in the html. only happens in firfox.
If comment 6 still exists in a version of Firefox with this fixed -- that is, in Firefox 42 -- please file a new bug for it.  But currencyDisplay: "name" does generally work now.
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.