Bug 214546 - Intl NumberFormat style currency incorrect format for 'es-CA' CAD
Summary: Intl NumberFormat style currency incorrect format for 'es-CA' CAD
Status: RESOLVED WONTFIX
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore JavaScript (show other bugs)
Version: WebKit Nightly Build
Hardware: All Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-07-20 02:16 PDT by Illia Bilichenko
Modified: 2020-07-29 11:51 PDT (History)
3 users (show)

See Also:


Attachments
Intl.NumberFormat problem (53.43 MB, video/mp4)
2020-07-27 05:44 PDT, Dmitry Boksha
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Illia Bilichenko 2020-07-20 02:16:03 PDT
Facing different results of currency format for locale 'es-CA' and CAD currency.

In Chrome(84.0.4147.89) and Firefox(78.0.2):
Intl.NumberFormat("es-CA", { style: 'currency', currency: "CAD" }).format(100.0) --> "100,00 CA$"

In Safari(14.0) & Webkit build(r264591):
Intl.NumberFormat("es-CA", { style: 'currency', currency: "CAD" }).format(100.0) --> "$110.00"

Unfortunately, I can't find any specification how it showed be formated. Is it expected behavior?
Comment 1 Radar WebKit Bug Importer 2020-07-27 02:16:15 PDT
<rdar://problem/66152350>
Comment 2 Dmitry Boksha 2020-07-27 05:41:25 PDT
I have a similar situation with 
Intl.NumberFormat('fr-US', { style: 'currency', currency: 'USD' }).format(99999999)

Chrome (84.0.4147.89) and Firefox (78.0.2)  --> "99 999 999,00 $US"
Safari (Version 13.1.2 (15609.3.5.1.3) --> "99999999,00 $US"
Comment 3 Dmitry Boksha 2020-07-27 05:44:10 PDT
Created attachment 405267 [details]
Intl.NumberFormat problem

But something interesting happens when I'm trying to select or copy/paste value.
Comment 4 Yusuke Suzuki 2020-07-29 11:51:34 PDT
Thanks for your reporting!

(In reply to Illia Bilichenko from comment #0)
> Facing different results of currency format for locale 'es-CA' and CAD
> currency.
> 
> In Chrome(84.0.4147.89) and Firefox(78.0.2):
> Intl.NumberFormat("es-CA", { style: 'currency', currency: "CAD"
> }).format(100.0) --> "100,00 CA$"
> 
> In Safari(14.0) & Webkit build(r264591):
> Intl.NumberFormat("es-CA", { style: 'currency', currency: "CAD"
> }).format(100.0) --> "$110.00"
> 
> Unfortunately, I can't find any specification how it showed be formated. Is
> it expected behavior?

Yes, both are right and expected behaviors because CAD's code is $.

(In reply to Dmitry Boksha from comment #3)
> Created attachment 405267 [details]
> Intl.NumberFormat problem
> 
> But something interesting happens when I'm trying to select or copy/paste
> value.

Strictly speaking, this is not WebKit's issue. They are bugs in ICU (https://github.com/unicode-org/icu).
Firefox and Chrome are bundling the latest ICU. Safari is using ICU which is installed in the system (macOS etc.).
If you upgrade the system, you will see the updated behavior in Safari.

I've tested these things with ToT JavaScriptCore with Big Sur beta 3 and ensured that they are now fixed because ICU is updated by the system update.