Repository navigation
fix(i18n): harden date locale handling - #5303
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
dce84a5 to
32e5c93
Compare
PR Analysis Report📚 Storybook PreviewView Storybook for this PR 🧪 Sandbox PreviewView Sandbox for this PR Modified ComponentsCalendar (@astryxdesign/core) · View in Storybook
DateInput (@astryxdesign/core) · View in Storybook
DateRangeInput (@astryxdesign/core) · View in Storybook
DateTimeInput (@astryxdesign/core) · View in Storybook
PowerSearch (@astryxdesign/core) · View in Storybook
Timestamp (@astryxdesign/core) · View in Storybook
Chart (@astryxdesign/lab) · View in Storybook
Schedule (@astryxdesign/lab) · View in Storybook
Bundle Size Summary
Accessibility AuditStatus: 3 accessibility violation(s) found — 1 critical, 2 serious. DateRangeInput - 1 issue(s)
PowerSearch - 1 issue(s)
Timestamp - 1 issue(s)
Visual RegressionStatus: Skipped — Broad stable scope is deferred to the daily release gate. It covers 974 trusted baseline shots instead of recapturing them for this PR. View the report Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
32e5c93 to
5c2d313
Compare
cixzhang
left a comment
There was a problem hiding this comment.
Thanks for chasing this down — six unthreaded call sites were real, and the rerender tests are the right proof.
Ideally I'd like to avoid the Gregorian default. None of our 30 shipped locales move under it, but Locale is any tag: set th-TH and someone reading one screen gets 22 สิงหาคม 2026 in the field and 2569 in the <Timestamp> beside it, because only DateInput goes through plainDateFormat. Thai Buddhist months line up with Gregorian, so that year was right before.
| before | after |
|---|---|
![]() |
![]() |
Persian is the case that wanted it, and that's the Calendar grid's fact rather than the formatter's:
plainDateFormat(m, {...DATE_FORMAT_MONTH_YEAR, calendar: 'gregory'}, locale)Everything else lands as it stands, and #5296's hydration paragraph is worth lifting into the changeset.
Does pinning the three grid headers cover it, or is there a case that needs the formatter itself pinned?
[Reviewed by Robohands]
|
Inline, |
|
Gregorian is intentional here, not a fallback chosen for one locale. Astryx's current date contract is Gregorian end to end: ISO/ This update therefore keeps Alternative-calendar support needs an explicit contract for demand, calendar selection and runtime switching, conversion, parsing, storage/serialization, grid arithmetic, constraints, and accessibility. That design is being tracked separately in #5498; until it is resolved, Gregorian is the only supported calendar system. |
5766a2f to
843b768
Compare
843b768 to
a84aa14
Compare
a84aa14 to
1ab1381
Compare
cixzhang
left a comment
There was a problem hiding this comment.
Thanks — this fixes the DateInput/Timestamp split I called out: the new head makes every date formatter Gregorian, and the focused browser pair now shows both Thai surfaces on 2026.
One API edge still needs fixing before merge. plainDateFormat accepts calendar inside Intl.DateTimeFormatOptions, then silently overwrites it; the new test proves calendar: 'buddhist' compiles but returns Gregorian. Could we remove calendar from the accepted options type so the Gregorian-only contract fails at compile time?
[Reviewed by Robohands]
plainDateFormat passed undefined to Intl.DateTimeFormat, so the locale resolved to whatever the runtime had. Across an SSR boundary that can differ and produce a hydration mismatch. Default to 'en', matching what useLocale() returns outside a provider, while keeping the optional locale parameter for provider-aware callers.
1ab1381 to
a3ab868
Compare
|
Thanks — I agree that silently overriding I changed the contract instead:
I audited the public surface and The new regression test fails against the silent override ( |
cixzhang
left a comment
There was a problem hiding this comment.
Thanks — honoring an explicit calendar closes the public API edge, while every Astryx date surface stays Gregorian. This is good now.
[Reviewed by Robohands]
No textual conflicts. Calendar.tsx, Calendar.test.tsx, Calendar.doc.mjs and styles.ts auto-merged cleanly alongside upstream's Calendar work (meta#5306 min/max opening month, meta#5453 320px reflow, meta#5120/meta#5303 locale, meta#6121 theme selectors). Merge fallout fixed here: - astracat F4: meta#6121 moved generated variant selectors from bare classes to data attributes, so the calendar-picker defineTheme assertion now expects `.astryx-calendar-picker[data-picker="year"]` instead of the stale `.astryx-calendar-picker.year`, matching how meta#6121 updated the sibling calendar-nav assertion. Red before: "expected ... to contain '.astryx-calendar-picker.year'" (Calendar.test.tsx:1885). - Provider locale: meta#5120/meta#5303 moved the static caption onto the InternationalizationProvider locale and added the @astryx/no-raw-intl-locale lint rule, which the picker option labels (still undefined-locale) now fail. They pass `locale` like the caption again, so the two caption modes keep agreeing on month names. New test "labels the month picker in the provider locale, like the static caption" was red first (es-ES rendered "March", expected "marzo"). Calendar.test.tsx 112/112 green after both.


Summary
plainDateFormatAPI’s explicitcalendaroption for compatibility.Visual evidence
French and Thai Calendar, DateInput, and Timestamp output from the updated head. Both follow the provider locale; Thai remains in Gregorian year 2026 rather than Buddhist year 2569.
Verification
2026instead of2569 BE). All 395 focused date tests now pass.pnpm lint:strictpasses with 0 errors (80 pre-existing warn-tier findings).