RESOLVED INVALID 249986
Intl.NumberFormat iOS bug
https://bugs.webkit.org/show_bug.cgi?id=249986
Summary Intl.NumberFormat iOS bug
mzoterov
Reported 2023-01-01 10:02:34 PST
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))
Attachments
Two screens with a bug (43.04 KB, application/zip)
2023-01-01 10:02 PST, mzoterov
no flags
Alexey Proskuryakov
Comment 1 2023-01-02 12:37:56 PST
'us-us' is a non-existent locale identifier, so Intl constructor falls back to your phone locale. You probably want to use 'en-US'.
Note You need to log in before you can comment on or make changes to this bug.