-
Notifications
You must be signed in to change notification settings - Fork 733
Description
Bug Description
The 24-hour time option from the Date & Time settings on iOS is ignored when
formatting dates using different Locales and Regions.
Intl.DateTimeFormat() formats the dates based solely on the locale and does not
take into account whether the user has enabled the 24-hour time on the device.
As an example, dates using en-GB locale always produce 24-hour times, and dates
using en-AU locale always produce AM/PM times. Options don't include hourCycle
or hour12 properties.
- I have run
gradle cleanand confirmed this bug does not occur with JSC - The issue is reproducible with the latest version of React Native.
Hermes git revision (if applicable):
React Native version: 0.82.1 (but reproducible down to 0.79.5 at least)
OS: iOS 18.6.2, on an iPhone 12 mini
Platform: arm64e
Steps To Reproduce
- On the phone, navigate to Settings app, General, Date & Time.
- Turn on the 24-hour time switch.
- Open the app and observe the dates formatted for different locales.
- Repeat steps 1-3, but this time turning off the 24-hour time switch.
Code example: Github Repository
The Expected Behavior
The dates presented in the demo app should all read "9:00" for the time component,
independently of the locale, as the user has forced the 24-hour format.
When the setting is turned off, the date using the en-AU locale should use a 12-hour
cycle ("9:00 am"), and the date using the en-GB should use a 24-hour cycle ("9:00").