iOS `DateTimeFormat` `{ hour: "numeric", minute: "numeric" }` does not use locale setting
Bug Description
console.log(
new Intl.DateTimeFormat('en-US', {
hour: 'numeric',
minute: 'numeric',
}).format(new Date('2021-09-30T18:00:00.000Z')),
);
The above prints 21:00 (incorrect because of locale) on iOS, but 9:00 PM (correct) on Android.
On iOS, using timeStyle: 'short' correctly prints 9:00 PM but on Android it prints 9/30/2021 as timeStyle is not implemented:
console.log(
new Intl.DateTimeFormat('en-US', {
timeStyle: 'short'
}).format(new Date('2021-09-30T18:00:00.000Z')),
);
Related: https://github.com/facebook/hermes/issues/1172#issuecomment-1776156538
Hey @andreialecu, thanks for reporting this. Could you also share which version of Hermes you are using, as well as the iOS/Android version you are testing on?
It would also be helpful to see what the output of resolvedOptions is to see what locale the implementation is actually using.
I would like to follow up on this issue since @andreialecu is not active.
Hi @neildhar and @tmikov.
Device: Physical Iphone, version 17.5.1 Hermes Version: 0.73.6
I am trying to format time in german like this:
new Intl.DateTimeFormat('de', {
hour: '2-digit',
minute: '2-digit',
}).format(date)
Time in german is 24 hour but it is showing it as 12 hour with am/pm.
However I use a time picker and pass it the locale. Using en correctly shows a 12 hour picker while passing de shows a 24 hour picker.
Please let me know if you still need info
@itsramiel Thanks for sharing this, I can repro this and I think I know what the issue is. We'll fix it soon.