Skip to content

feat(DateInput, DateTimeInput): a non-Gregorian calendar uses the Astryx picker - #10031

Closed
nynexman4464 wants to merge 24 commits into
mainfrom
nynexman4464/feat/calendar-native-fallback
Closed

nynexman4464 wants to merge 24 commits into
mainfrom
nynexman4464/feat/calendar-native-fallback

Conversation

@nynexman4464

@nynexman4464 nynexman4464 commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Stack: #9643 → #10031 → #9794 → #9653 → #9837 → #9842

Declared stack: each pull request targets main and contains the one below it, so review only its own commits (the ones above #9643). The stack lands together.
This part was #9793, which GitHub marked merged into #9643's branch during a batch attempt; it is reopened here with the same commits and description.

This implements spec:AST-111 (approved in #9605) FR15 and DEC-7, with FR5's fallback, for DateInput and DateTimeInput.

User need

A Persian, Hebrew, or Japanese user on a phone opens a date field and sees the native date picker. That picker is Gregorian (Android) or follows the device calendar (iOS), so the date they pick reads as a different date than the field shows. On a desktop, an explicit presentation="native" has the same problem.

Problem and solution fit

  • FR15: with a calendar other than gregory or iso8601, every presentation that would show <input type="date"> uses the Astryx popover on a fine pointer and the bottom sheet on a coarse pointer. This covers adaptive-native (the default), the deprecated nativePicker values, and an explicit presentation="native", which also warns once in development (DEC-7). DateTimeInput's date and time surfaces follow the same rule.
  • useCalendarPresentation resolves the calendar and the presentation policy it allows; calendarPickerPresentation in inputPresentation.ts maps native and adaptive-native to adaptive-bottom-sheet; isGregorianCalendar in the calendar-system utility names the calendars the native control can show, and useTypedDate now uses it too.
  • Values stay Gregorian ISO (FR3). Without Temporal, calendars that need it fall back to Gregorian, and with them the native control (FR5). A -u-ca- keyword in the provider locale does not select the calendar, so such a field keeps Gregorian dates and the native control; calendar on the component or the provider selects one.
  • Not yet: on a coarse pointer, the bottom sheet and the closed field text still show Gregorian dates. The next PR makes them follow the calendar (FR16). The records state the bottom sheet as an implementation gap. The calendar JSDoc, the consumer docs for calendar and the changeset say that on a coarse pointer the field and its bottom sheet show Gregorian dates, and the dense nativePicker docs name the calendar exception.
  • AST-043 FR1, FR2 and FR3, DateInput FR2 and DateTimeInput FR3 name the calendar exception.

Current specification

  • spec:AST-111 FR15, FR3, FR5 and DEC-7 (approved in spec(AST-111): date components use the calendar the application chooses #9605).
  • spec:AST-043 FR1–FR3 now name the one exception to an explicit native: the calendar.
  • Projected into component:DateInput FR21 and component:DateTimeInput FR12, each with a Current-state gap for the Gregorian bottom sheet.
  • component:InternationalizationProvider FR10 now says only the bottom sheet and DateRangeInput show Gregorian dates. The provider's docs and JSDoc say the same and keep main's statement that Timestamp, PowerSearch, and Lab's Schedule write their dates in the calendar.

Public delta and caller burden

  • Behavior: under a non-Gregorian calendar, no presentation renders a native date control. An explicit native warns once in development.
  • No change for gregory/iso8601, and no change without Temporal for the calendars that need it.
  • No new props or types.
  • Caller decisions: none. A field that needs the native picker stays Gregorian.

Design and alternatives

  • Rejected (spec:AST-111 DEC-7): keeping an explicit native native. The device, not the application, would then choose the calendar.

Evidence

  • Unit tests: every presentation and deprecated nativePicker value × Gregorian/Persian × fine/coarse pointer for DateInput and DateTimeInput, the provider calendar, and the explicit-native warning (once, and not for Gregorian or the defaults).
  • No-Temporal tests: a Persian field becomes Gregorian with the native control and a warning; an explicit native stays native; a Persian bottom sheet shows Gregorian months; a Persian DateTimeInput shows Gregorian native controls.
  • A mutation that disables FR15 fails the presentation tests.
  • Real browsers against Storybook with a desktop viewport: Chromium 149 and Firefox 151 with native Temporal, with the polyfill, and with no Temporal; WebKit (Safari 26.5) with the polyfill and with no Temporal.

Screenshots

Chromium 149 with native Temporal unless noted.

State Screenshot
Desktop, Persian: an explicit presentation="native" uses the Astryx popover Desktop, Persian: an explicit presentation="native" uses the Astryx popover
No Temporal: Persian falls back to Gregorian, so the native picker is allowed again No Temporal: Persian falls back to Gregorian, so the native picker is allowed again

Scope

  • One capability is added.
  • Unrelated fixes, cleanup, and policy changes were removed or split.
  • Consumer docs, focused tests, and migration evidence ship with the feature.
  • Public text and artifacts contain no internal Meta context.

Testing

  • pnpm exec vitest run --maxWorkers=4 over the presentation and no-Temporal tests, packages/core/src/i18n, docPropLiterals.test.ts and the CLI core prop docs test, after the restack onto current main (with Lab's Schedule): 16 files, 218 tests passed. CI runs the full suites.
  • CLI docs tests (golden reads, core prop docs, core doc quality, core doc types) and docPropLiterals.test.ts: 5 files, 38 tests pass.
  • pnpm exec tsc --noEmit -p packages/core: passes.
  • pnpm check:knowledge, pnpm check:changesets: pass.
  • node scripts/pre-review.mjs --base nynexman4464/feat/calendar-typed-entry: 1,072 authored lines.

Writing rubric results

spec:AST-043

  • R1 narration: the FR1, FR2 and FR3 edits are present tense. The existing Intent still opens with "currently has two answers"; left as is, to keep this amendment minimal.
  • R2 research: none.
  • R3 evidence: the FR2 verification row says "eligibility fallback". No change references.
  • R4 rejected alternatives: none added.
  • R5 change references: none.
  • R6 open questions: none.

component:DateInput

  • R1 narration: FR21, ORD1 and the AST-013 exception are present tense. The touch-and-native gap is replaced by a narrower present-tense gap: the bottom sheet shows Gregorian dates. The Compatibility/readiness row keeps the sheet wheels' markup and time-order key (FR17) sentences and changes only "the calendar on the touch and native surfaces" to "the calendar on the touch surface".
  • R2 research: none.
  • R3 evidence: the FR21 basis and verification cite tests and real-browser runs. The existing (#5074) is part of a quoted test title.
  • R4 rejected alternatives: none.
  • R5 change references: only that quoted test title.
  • R6 open questions: none.

component:DateTimeInput

  • R1 narration: FR12 and ORD1 are present tense. The touch-and-native gap is replaced by a gap for the Gregorian Date panel of the bottom sheet. The Public contract row says the date segment and its popover show the calendar, matching that gap.
  • R2 research: none.
  • R3 evidence: tests only.
  • R4 rejected alternatives: none.
  • R5 change references: none.
  • R6 open questions: none.

component:InternationalizationProvider

  • R1 narration: the FR10 edit is present tense and names the surfaces that stay Gregorian.
  • R2 research: none.
  • R3 evidence: none added.
  • R4 rejected alternatives: none.
  • R5 change references: none.
  • R6 open questions: none.

Both inputs take a calendar prop and otherwise follow the provider's calendar. useTypedDate reads typed text with the calendar-date parser, commits once per complete date, and names unreadable, missing, and out-of-range dates. The popover calendar and the date formats follow the calendar; values stay Gregorian ISO dates.
… fallback

- The accessible description names the calendar only when the field's
  calendar differs from the provider's calendar, after the Gregorian
  fallback, so an all-Persian app never repeats it and a Gregorian field
  in a Persian app names the Gregorian calendar.
- Gregorian text that the calendar parser reads as a nonexistent date
  falls back to parseDateInput on Enter or blur, so 13/5/2026 in en-US
  still commits as 13 May 2026. A date neither reads stays rejected.
- A caller placeholder replaces the format hint in every state.
- The hint's example date is today when the field accepts it, else the
  nearest accepted date, from a new nearestAcceptedDate helper.
…r the Enter requirement

DateInput FR16 and DateTimeInput FR10 already name the Enter-and-form-submit rule, so typed entry in a calendar is DateInput FR17 and DateTimeInput FR11.
… reading

Letter-free text that parseDateInput does not read in a day-first locale is not a date, so the Gregorian fallback leaves it unread.
…retyped date again

Text kept on Enter or blur shows its error as the field status, and a status the field shows is not announced a second time by the field's own alert. A commit ends the typing session, so a date retyped after the caller keeps its value is reported again. The provider docs and record say that the popover field follows the calendar while the bottom-sheet and native surfaces stay Gregorian, and the records state that an explicit -u-ca- locale is the application's request.
…ler status

Kept rejected text now shows its own error as the field status even when
the caller sets status, so the reason is visible and not only announced.
The changeset also says that a date only a dateConstraints rule rejects
says it is not available.
…ian dates

The DateInput and DateTimeInput records and the changeset say that a
provider locale with a -u-ca- keyword keeps Gregorian dates; set
calendar to choose one.
…ts and what typed text stays

parseDateInput reads only text the field cannot otherwise read and a date the locale's field order lacks; a one- or three-digit year is not a date. DateTimeInput's committed date-time row keeps rejected date text, as FR11 does. INV10 names the popover fields of DateInput and DateTimeInput among the displays that follow the calendar. The invalid-date and format-hint message descriptions match the field.
…wo-digit year window

DateTimeInput FR11 commits on Enter or blur only the text that DateInput FR20
names: text the field cannot otherwise read and a date the locale's field
order lacks, with a one- or three-digit year not a date. DateInput FR6 drops
the month-first fallback for a two-digit year, which the calendar parser now
reads, and the compatibility line names the two-digit year window.
… row; a date editor shows dates as its input does
…ryx picker

The native date control shows only Gregorian dates. In a calendar other than gregory or iso8601, native and adaptive-native use the popover on a fine pointer and the bottom sheet on a coarse pointer, and an explicit native warns in development. AST-043 FR1 and FR3 name the exception.
…g and presentation

useTypedDate calls isGregorianCalendar, the same test that decides when the native control can show the calendar. The presentation test names read the expected surface, and the warning comment says what keys it. The provider docs and record say that only the bottom sheet stays Gregorian, and the changeset says that an explicit -u-ca- locale selects the calendar the same way.
The changeset says that a provider locale with a -u-ca- keyword keeps
Gregorian dates and the native control; set calendar to choose a
calendar.
… narrow the calendar surface claims

DateInput's compatibility row keeps the sheet wheels' markup and time-order key sentences (FR17) and changes only the touch-surface calendar entry. DateTimeInput's calendar shows in the date segment and its popover. On a coarse pointer the field and its bottom sheet show Gregorian dates. The dense nativePicker docs name the calendar exception.
@vercel

vercel Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Nov 5, 2026 4:00am UTC

Request Review

@astracat-bot

astracat-bot Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
❓ Needs maintainer input (for maintainers only) Nov 5, 2026, 4:00 AM UTC

@nynexman4464

Copy link
Copy Markdown
Contributor Author

/approve-spec 892bc18

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 5, 2026
@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 5, 2026

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This pull request is reviewed as part of its stack; see the review on #9842.

@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · 892bc18

Storybook · Sandbox · built from this PR's head

Modified components

Component Size LoC Visual · A11y · RTL
Calendar · Storybook 57.4 kB (0) · 9.3 kB CSS (0) 1,714 (0) ✗ · ✓ · ✓
PowerSearch · Storybook 🔴 256.8 kB (+7.1 kB) · 22.3 kB CSS (0) 7,201 (0) ✓ · ✓ · ✓
DateInput · Storybook 🔴 161.8 kB (+6.8 kB) · 15.5 kB CSS (0) 5,391 (+288) ✓ · ✓ · ✓
6 more components
Component Size LoC Visual · A11y · RTL
DateTimeInput · Storybook 🔴 183.7 kB (+6.6 kB) · 17.2 kB CSS (0) 3,623 (+58) ✓ · ✓ · ✓
DateRangeInput 75.8 kB (0) · 11.2 kB CSS (0) — — · — · —
TimeInput 140.4 kB (0) · 14.5 kB CSS (0) — — · — · —
Timestamp 22.9 kB (0) · 8.9 kB CSS (0) — — · — · —
lab/Comments 271.5 kB (new) · 2.5 kB CSS (new) — — · — · —
lab/CommentThread 266.4 kB (new) · 2.4 kB CSS (new) — — · — · —
Visual changes: 2 snapshots in 1 component

A change is a question for the reviewer, not a failure.

Component · story Before After Diff
Calendar · Default (neutral, light) before frame after frame diff frame
Calendar · Default (neutral, dark) before frame after frame diff frame

Package size: measured; main has no measurement of the merge base to compare yet.

API changes: cli +8 · ~1 · −0 (against the merge base's committed report); core +2 · ~0 · −0

Committed API report behind this build: cli 9 rows, core 3 rows; run pnpm api:report.

11 API changes (advisory)
Package Where Signature Usage
+ cli ./api · Types · type SearchResultEntry deprecated?: ComponentDeprecation | undefined import type {SearchResultEntry} from '@astryxdesign/cli/api'; const x: SearchResultEntry = {deprecated: …}
+ cli ./authoring · Types · interface ComponentDeprecation interface ComponentDeprecation import type {ComponentDeprecation} from '@astryxdesign/cli/authoring'
+ cli ./authoring · Types · interface MultiComponentDoc deprecated?: ComponentDeprecation import type {MultiComponentDoc} from '@astryxdesign/cli/authoring'; const x: MultiComponentDoc = {deprecated: …}
+ cli ./authoring · Types · interface SingleComponentDoc deprecated?: ComponentDeprecation import type {SingleComponentDoc} from '@astryxdesign/cli/authoring'; const x: SingleComponentDoc = {deprecated: …}
+ cli ./doc · Types · interface ComponentBaseDoc deprecated?: ComponentDeprecation import type {ComponentBaseDoc} from '@astryxdesign/cli/doc'; const x: ComponentBaseDoc = {deprecated: …}
+ cli ./doc · Types · interface SubComponentDoc deprecated?: ComponentDeprecation import type {SubComponentDoc} from '@astryxdesign/cli/doc'; const x: SubComponentDoc = {deprecated: …}
+ cli ./doc · Also exported from an earlier entry point · ComponentDeprecation ComponentDeprecation (./authoring) import {ComponentDeprecation} from '@astryxdesign/cli/doc'
+ cli ./template · Also exported from an earlier entry point · ComponentDeprecation ComponentDeprecation (./authoring) import {ComponentDeprecation} from '@astryxdesign/cli/template'
~ cli ./api · Functions · function search function search: (query: string, options?: { cwd?: string | undefined; type?: "template" | "component" | "hook" | "theme" | "doc" | undefined; limit?: number | undefined }) => Promise<SearchResponse> → function search: (query: string, options?: { cwd?: string | undefined; type?: "template" | "component" | "doc" | "theme" | "hook" | undefined; limit?: number | undefined }) => Promise<SearchResponse> import {search} from '@astryxdesign/cli/api'; search(…)
+ core . · Components · component DateInput prop calendar?: CalendarSystem = the InternationalizationProvider's calendar, else `'gregory'` <DateInput calendar="s calendar, else `" />
+ core . · Components · component DateTimeInput prop calendar?: CalendarSystem = the InternationalizationProvider's calendar, else `'gregory'` <DateTimeInput calendar="s calendar, else `" />

Touched components checked; add ci:run-visual, ci:run-a11y or ci:run-rtl to run the full suites.


Generated by PR Enrichment workflow | View full report

@nynexman4464

Copy link
Copy Markdown
Contributor Author

Folded into #9643: the review asked for the shared typed-entry hook (#9837) in the same change as the typed entry (#9643), so #9643 now carries this part unchanged, with this description reproduced as its own part. The declared stack is #9643 → #9842.

nynexman4464 added a commit that referenced this pull request Nov 5, 2026
…ates in the active calendar (#9643, #9842)

Lands the declared stack #9643 → #9842; each part was reviewed on its own pull request.

- #9643 (with #10031, #9794, #9653 and #9837 folded in): DateInput and DateTimeInput read and write typed dates in the active calendar; a non-Gregorian calendar uses the Astryx picker instead of the native control; the bottom sheet shows months of the calendar; DateRangeInput shows the range in the calendar; one shared typed-entry hook serves both fields.
- #9842: while DateInput or DateTimeInput is disabled or busy, typed text stays without a rejection, and commits or gives way once the field is editable.

Fixes #8958.
@github-actions
github-actions Bot deleted the nynexman4464/feat/calendar-native-fallback branch November 5, 2026 06:03

This branch was successfully deployed

1 active deployment
Preview — 892bc188 Deployed Nov 5, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot. needs:design-review Affects visuals — Design should review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant