facebook / facebook/hermes

Intl.DateTimeFormat returns incorrect values on real iOS devices

Open
#1,172 4 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
JavaScript
Stars
11.3k
Forks
865
Avg merge
1h 30m
Merged PRs (30d)
3

Description

Bug Description

Greetings 👋
We use Luxon in our react-native project for date management. When parsing dates and attempting to output the monthShort or weekdayShort components whilst using a real iOS device, we get null values back.

There is an open issue in Luxon stating that this is an implementation issue in Hermes as it works correctly for other JavaScript engines: https://github.com/moment/luxon/issues/1500

Hermes version: bundled with react-native
React Native version: 0.72.5
Platform: iOS
OS version: 16.6.1

Steps To Reproduce

Direct Hermes example:

https://github.com/moment/luxon/issues/1500#issuecomment-1709612387

Luxon example:

import { DateTime } from 'luxon'
...

  console.log(DateTime.now().month) // -> 10
  console.log(DateTime.now().monthShort) // -> null, but expected Oct or equivalent

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the direct Hermes reproduction from the linked Luxon issue on a real iOS device, then compare the Intl.DateTimeFormat behavior with other JavaScript engines. Locate the relevant Hermes Intl implementation and tests; done means monthShort and weekdayShort return the expected values in the Luxon example rather than null.

Written by the indexing model from the issue text.

Assessment

Tech stack
ios, javascript, react-native
Domain
internationalization, mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.