Bug 249986

Summary: Intl.NumberFormat iOS bug
Product: WebKit Reporter: mzoterov
Component: JavaScriptCoreAssignee: Nobody <webkit-unassigned>
Status: RESOLVED INVALID    
Severity: Normal CC: ap
Priority: P2    
Version: Safari 16   
Hardware: iPhone / iPad   
OS: iOS 16   
Attachments:
Description Flags
Two screens with a bug none

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'.