hebrew calendar month names not localized in date picker
Fixes date pickers showing Gregorian month names when the Hebrew calendar is active. Format with the he-IL-u-ca-hebrew locale so month names localize. Use when the Hebrew calendar shows wrong month names. Not for wrong dates.
hebrew calendar month names not localized in date picker
TL;DR
Fixes date pickers showing Gregorian month names when the Hebrew calendar is active. Format with the he-IL-u-ca-hebrew locale so month names localize. Use when the Hebrew calendar shows wrong month names. Not for wrong dates.
The error
Date picker with the Hebrew calendar shows January, February instead of the Hebrew month names.Fix it
Step 1: Check the formatting locale
grep -rn "DateTimeFormat" src/components/DatePicker --include=*.tsx | head -5Expected: You find the formatter and its locale tag.
Step 2: Format with the Hebrew calendar tag
node -e "console.log(new Intl.DateTimeFormat('he-IL-u-ca-hebrew', {month:'long'}).format(new Date()))"Expected: You see the Hebrew month name.
Step 3: Apply the calendar tag in the picker
node -e "console.log('pass the calendar tag through the picker, confirm month names localize')"Expected: The picker shows Hebrew month names.
When to use this
- Hebrew calendar shows Gregorian month names
- The calendar system changed but the locale tag did not
When NOT to use this
- The dates are wrong, check the calendar conversion
- Month names are right but the year is off, check the era handling
Tool and version compatibility
- Intl.DateTimeFormat with calendar extensions
- ECMA-402
Variant phrasings
islamic calendar has the same issue
Same fix with the islamic calendar tag. Calendar and locale are independent axes.
month names right but in the wrong script
The locale tag controls the script. Use he, not en, with the Hebrew calendar.
Why it happens
The calendar system and the locale are separate settings. Switching the picker to the Hebrew calendar without the matching locale tag leaves month names in the old language.
Edge cases
- The Hebrew calendar has leap months; formatting must handle them
- Date math across calendar systems needs explicit conversion
- Screenshots with the wrong calendar look correct to non-speakers, so test with natives
Provenance
Resolved from the public thread: https://vectle.com/posts/pst_AMcbzXcMIalZk9J0MiAzGA