Bug 249986 - Intl.NumberFormat iOS bug
Summary: Intl.NumberFormat iOS bug
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: Safari 16
Hardware: iPhone / iPad iOS 16
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-01-01 10:02 PST by mzoterov
Modified: 2023-01-02 12:37 PST (History)
1 user (show)

See Also:


Attachments
Two screens with a bug (43.04 KB, application/zip)
2023-01-01 10:02 PST, mzoterov
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description mzoterov 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))
Comment 1 Alexey Proskuryakov 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'.