| Summary: | Intl.NumberFormat iOS bug | ||||||
|---|---|---|---|---|---|---|---|
| Product: | WebKit | Reporter: | mzoterov | ||||
| Component: | JavaScriptCore | Assignee: | Nobody <webkit-unassigned> | ||||
| Status: | RESOLVED INVALID | ||||||
| Severity: | Normal | CC: | ap | ||||
| Priority: | P2 | ||||||
| Version: | Safari 16 | ||||||
| Hardware: | iPhone / iPad | ||||||
| OS: | iOS 16 | ||||||
| Attachments: |
|
||||||
'us-us' is a non-existent locale identifier, so Intl constructor falls back to your phone locale. You probably want to use 'en-US'. |
Created attachment 464283 [details] Two screens with a bug Hello and Happy New Year! Today I found a bug in the mobile version of the Safari engine. The problem can be seen in detail in the screenshots, but I will describe it here: On all mobile devices running iOS 16.x, Intl.NumberFormat behaves incorrectly, putting a comma instead of a period, which leads to some errors when trying to convert a number back using Number(...). On the desktop version of Safari, there is no such problem, and it behaves as it should. Check code: const format = new Intl.NumberFormat (`us-us`, { style: `decimal`, useGrouping: false minimumFractionDigits: 0, maximumFractionDigits: 6, }); console.log(formate.format(1.44))