Repository navigation
feat(DateInput, DateTimeInput): the bottom sheet shows months of the calendar - #9794
nynexman4464 wants to merge 30 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
There was a problem hiding this comment.
Approval waits on an engineering owner's decision about the calendar direction, and one fix is needed whichever way it goes.
- Spec decision: on
main,architecture:internationalizationINV10 still keeps date grids and navigation Gregorian, andspec:AST-111(#9605) is a draft. The calendar months, leap-month wheel and era years that this PR writes intocomponent:DateInputFR17 andcomponent:DateTimeInputFR11 therefore need an engineering owner to record the decision by commenting/approve-spec <full head SHA>on this pull request, which the author may do as an engineering owner, or need AST-111 and its INV10 rewrite to land first. - Era dropped in DateTimeInput's sheet:
TouchDateTimeField.tsx:696formats the date segment withformatCalendarDateinstead of the sharedformatCalendarDateText(selectedDate, 'date_long', locale, calendar), so on a coarse pointer the era disappears (۱۱ آبان ۱۴۰۵instead of۱۱ آبان ۱۴۰۵ ه.ش.infa, and likewise for Hebrew,th-THBuddhist andamEthiopic). Please switch to the shared formatter and add afaorth-THcase to "writes the sheet date segment in the calendar".
Non-blocking: Gregorian sheets in locales such as ar-EG and fa now show locale digits on day buttons, and the changeset could say so.
[Automated review]
| } | ||
| return plainDateFormat(selectedDate, DATE_FORMAT_LONG, locale); | ||
| }, [selectedDate, locale]); | ||
| return formatCalendarDate(calendar, selectedDate, DATE_FORMAT_LONG, locale); |
There was a problem hiding this comment.
This writes the date with formatCalendarDate, but DateInput's sheet field and this field's fine-pointer segment use formatCalendarDateText(pd, 'date_long', locale, calendar), which adds the era where the locale's long pattern leaves it out. In fa Persian this shows ۱۱ آبان ۱۴۰۵, while the same value reads ۱۱ آبان ۱۴۰۵ ه.ش. on a fine pointer; Hebrew, th-TH Buddhist and am Ethiopic differ the same way.
return formatCalendarDateText(selectedDate, 'date_long', locale, calendar);| // A year that spans an era change names the era of the date the wheels | ||
| // show, as the iOS date wheels do, so its row changes as the month turns. | ||
| // Rows keep their size: the wheel columns share the width equally and every | ||
| // row is one fixed height, whatever its label. |
There was a problem hiding this comment.
Non-blocking (comment style): the first sentence has 30 words and two topics. A shorter version that keeps the reason:
// A year with an era change takes the era of the shown date, as iOS does.
// Its row text changes as the month turns. Each row keeps one fixed size.302c777 to
bd1f569
Compare
6afec54 to
264269c
Compare
There was a problem hiding this comment.
Approval waits on an engineering owner's decision about the calendar direction, and one fix is needed whichever way it goes.
- Spec decision: on
main,architecture:internationalizationINV10 still keeps date grids and navigation Gregorian, andspec:AST-111(#9605) is a draft, so the calendar months, leap-month wheel and era years this PR writes intocomponent:DateInputFR17 andcomponent:DateTimeInputFR11 need an engineering owner to record the decision by commenting/approve-spec <full head SHA>on this pull request (the author may do so as an engineering owner), or need AST-111 and its INV10 rewrite to land first. - Era dropped in DateTimeInput's sheet:
TouchDateTimeField.tsx:696formats the date segment withformatCalendarDateinstead of the sharedformatCalendarDateText(selectedDate, 'date_long', locale, calendar), so on a coarse pointerfa-IRshows۱۱ آبان ۱۴۰۵where DateInput's sheet shows۱۱ آبان ۱۴۰۵ ه.ش.(andth-THdropsพ.ศ.); please switch to the shared formatter and add afaorth-THcase to "writes the sheet date segment in the calendar".
Non-blocking: Gregorian sheets in locales such as ar-EG and fa now show locale digits on day buttons, and the changeset could say so.
[Automated review]
| } | ||
| return plainDateFormat(selectedDate, DATE_FORMAT_LONG, locale); | ||
| }, [selectedDate, locale]); | ||
| return formatCalendarDate(calendar, selectedDate, DATE_FORMAT_LONG, locale); |
There was a problem hiding this comment.
This writes the date with formatCalendarDate, but DateInput's sheet field and this field's fine-pointer segment use formatCalendarDateText(pd, 'date_long', locale, calendar), which adds the era where the locale's long pattern leaves it out. In fa-IR Persian this shows ۱۱ آبان ۱۴۰۵ while the same value reads ۱۱ آبان ۱۴۰۵ ه.ش. in DateInput's sheet; th-TH Buddhist drops พ.ศ. the same way.
return formatCalendarDateText(selectedDate, 'date_long', locale, calendar);| // A year that spans an era change names the era of the date the wheels | ||
| // show, as the iOS date wheels do, so its row changes as the month turns. |
There was a problem hiding this comment.
Non-blocking (comment style): this sentence has 30 words and two topics. A shorter version that keeps the reason:
// A year with an era change takes the era of the shown date, as iOS does.
// Its row text changes as the month turns.bd1f569 to
698fdd8
Compare
264269c to
6361f62
Compare
There was a problem hiding this comment.
Approval waits on an engineering owner's decision about the calendar direction, and one fix is needed whichever way it goes.
- Spec decision: on
main,architecture:internationalizationINV10 still keeps date grids and navigation Gregorian andspec:AST-111(#9605) is a draft, so the calendar months, leap-month wheel and era years this pull request writes intocomponent:DateInputFR17 andcomponent:DateTimeInputFR11 need an engineering owner to record the decision by commenting/approve-spec <full head SHA>on this pull request (the author may do so as an engineering owner), or need AST-111 and its INV10 rewrite to land first. - Era dropped in DateTimeInput's sheet:
TouchDateTimeField.tsx:696formats the date segment withformatCalendarDateinstead of the sharedformatCalendarDateText(selectedDate, 'date_long', locale, calendar), so on a coarse pointerfa-IRshows۱۱ آبان ۱۴۰۵where DateInput's sheet shows۱۱ آبان ۱۴۰۵ ه.ش.(andth-THdropsพ.ศ.); please switch to the shared formatter and add afa-IRorth-THcase to "writes the sheet date segment in the calendar".
Non-blocking: Gregorian sheets in locales such as ar-EG and fa now show locale digits on day buttons, and the changeset could say so.
[Automated review]
| } | ||
| return plainDateFormat(selectedDate, DATE_FORMAT_LONG, locale); | ||
| }, [selectedDate, locale]); | ||
| return formatCalendarDate(calendar, selectedDate, DATE_FORMAT_LONG, locale); |
There was a problem hiding this comment.
This writes the date with formatCalendarDate, but DateInput's sheet field and this field's fine-pointer segment use formatCalendarDateText(pd, 'date_long', locale, calendar), which adds the era where the locale's long pattern leaves it out. In fa-IR Persian this shows ۱۱ آبان ۱۴۰۵ while DateInput's sheet shows ۱۱ آبان ۱۴۰۵ ه.ش.; th-TH Buddhist drops พ.ศ. the same way.
return formatCalendarDateText(selectedDate, 'date_long', locale, calendar);| // A year that spans an era change names the era of the date the wheels | ||
| // show, as the iOS date wheels do, so its row changes as the month turns. |
There was a problem hiding this comment.
Non-blocking (comment style): this sentence has 30 words and two topics. A shorter version that keeps the reason:
// A year with an era change takes the era of the shown date, as iOS does.
// Its row text changes as the month turns.698fdd8 to
5576696
Compare
6361f62 to
9662010
Compare
There was a problem hiding this comment.
Approval waits on an engineering owner's decision about the calendar direction, and one description fix is needed whichever way it goes.
- Spec decision: on
main,architecture:internationalizationINV10 still keeps date grids and navigation Gregorian andspec:AST-111(#9605) is a draft, so the calendar months, leap-month wheel, era years and calendar field text this pull request writes intocomponent:DateInputFR18,component:DateTimeInputFR12 andcomponent:InternationalizationProviderFR10 need an engineering owner to record the decision by commenting/approve-spec <full head SHA>on this pull request (the author may do so as an engineering owner), or need AST-111 and its INV10 rewrite to land first. - Description claims a change that already shipped: the Public delta says "The bottom sheet's day numbers now use locale digits in every calendar", but
MonthScroller.tsxalready rendersplainDateFormatDayNumber(day.dayNumber, locale)on the base and onmain; please delete that bullet or say the digits are unchanged.
Not blocking this pull request:
apps/storybook/stories/DateInput.stories.tsximportsInternationalizationProvidertwice (line 9 and lines 14–17), which stops Storybook from indexing the file, so the three stories added here cannot load; the duplicate comes from the base branch and is best fixed there.mainnow definescomponent:DateInputFR17 and FR18 as sheet-wheel rules, so the stack's calendar clauses (and this pull request's "followscomponent:DateInputFR18" in DateTimeInput) need new IDs when it rebases.- The era fix in DateTimeInput's sheet date segment is confirmed:
fa-IRandth-THnow match DateInput's sheet.
[Automated review]
| // The day the picker keeps: the selected date's day of its month. The month | ||
| // and year view names its era from this day in the shown month, the way the | ||
| // year wheel does, for a month that spans an era change. |
There was a problem hiding this comment.
Non-blocking (comment style): the second sentence has 29 words and two topics. A shorter version that keeps the reason:
// The day the picker keeps: the selected date's day of its month. A month
// with an era change takes its heading era from this day.| // The day the picker keeps: the selected date's day of its month. The month | ||
| // and year view names its era from this day in the shown month, the way the | ||
| // year wheel does, for a month that spans an era change. |
There was a problem hiding this comment.
Non-blocking (comment style): the same 29-word sentence as in TouchDateField.tsx. A shorter version:
// The day the picker keeps: the selected date's day of its month. A month
// with an era change takes its heading era from this day.5576696 to
d1906f2
Compare
9662010 to
6b4a555
Compare
There was a problem hiding this comment.
Approval waits on an engineering owner's decision about the calendar direction, and one description fix is needed whichever way it goes.
- Spec decision: on
main,architecture:internationalizationINV10 still keeps date grids and navigation Gregorian andspec:AST-111(#9605) is a draft, so the calendar months, leap-month wheel, era years and calendar field text that this pull request writes intocomponent:DateInputFR18,component:DateTimeInputFR12 andcomponent:InternationalizationProviderFR10 need an engineering owner to record the decision by commenting/approve-spec <full head SHA>on this pull request (the author may do so as an engineering owner), or need AST-111 and its INV10 rewrite to land first. - Description claims a change that already shipped: the Public delta says "The bottom sheet's day numbers now use locale digits in every calendar", but
MonthScroller.tsxalready rendersplainDateFormatDayNumber(day.dayNumber, locale)on the base and onmain, so please delete that bullet or say the digits are unchanged.
Not blocking this pull request:
mainnow definescomponent:DateInputFR17 and FR18 as sheet-wheel rules, so the stack's calendar clauses (and DateTimeInput's "followscomponent:DateInputFR18") need new IDs when it rebases.- The comments at
TouchDateField.tsx:760-762andTouchDateTimeField.tsx:679-681have a 29-word second sentence, andmonthGeometry.ts:185-186is passive; shorter wording is suggested in the review comments.
[Automated review]
| // Temporal arithmetic is slow next to a render, and the same months are | ||
| // asked for on every render of the panes and the wheels. |
There was a problem hiding this comment.
Non-blocking (comment style): this sentence is passive ("are asked for") and joins two topics. A shorter version that keeps the reason:
// Temporal arithmetic is slow next to a render. The panes and the wheels ask
// for the same months on every render.d1906f2 to
d35963a
Compare
…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.
…s in the field too
…calendar The sheet's month scroller lays out calendar months in six-row panes, the month wheel lists the months of the calendar year with leap months, and year labels carry the era. A year with an era change is labeled with the era of the shown month, and the month heading follows the kept day across an era change.
…put's sheet does TouchDateTimeField writes the date with formatCalendarDateText, so fa-IR Persian and th-TH Buddhist sheets keep their era. The MonthScroller Reduced Motion test passes the month model the scroller now takes. A wheel comment is shorter. The provider docs and record say that DateInput and DateTimeInput show the calendar on every surface, and the changeset says that an explicit -u-ca- locale selects the calendar too.
The changeset says that a provider locale with a -u-ca- keyword keeps the Gregorian sheet; set calendar to choose a calendar.
INV10 names DateInput and DateTimeInput among the displays that follow the calendar on every surface.
…Days useCalendarMonthDays is gone from main: useCalendarDays now takes a calendar. The scroller passes the year and month numbers of its calendar month. calendarMonthOfYear reuses calendarMonthFromYearMonth for calendars that are not Gregorian-aligned, and the month model reads year and month numbers with main's calendarYearMonthOf, which replaces the sheet's own.
…he lost native warning as a failure DateInput FR21 states that a pane's grid name keeps the era of its month's middle day. The DateTimeInput FR12 verification row again fails a missing warning for an explicit native.
69313dd to
cbc5173
Compare
|
/approve-spec cbc5173 |
There was a problem hiding this comment.
This pull request is reviewed as part of its stack; see the review on #9842.
PR Analysis Report🔎 Preview ·
|
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| Calendar · Storybook | 57.7 kB (+214 B) · 9.3 kB CSS (0) | 1,714 (0) | ✗ · ✓ · ✓ |
| PowerSearch · Storybook | 🔴 257.8 kB (+8.1 kB) · 22.3 kB CSS (0) | 7,201 (0) | ✓ · ✓ · ✓ |
| DateInput · Storybook | 🔴 162.7 kB (+7.8 kB) · 15.5 kB CSS (0) | 5,510 (+407) | ✓ · ✓ · ✓ |
6 more components
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| DateTimeInput · Storybook | 🔴 184.5 kB (+7.4 kB) · 17.2 kB CSS (0) | 3,632 (+67) | ✓ · ✓ · ✓ |
| DateRangeInput | 76.0 kB (+211 B) · 11.2 kB CSS (0) | — | — · — · — |
| TimeInput | 140.4 kB (0) · 14.5 kB CSS (0) | — | — · — · — |
| Timestamp | 22.9 kB (−8 B) · 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) | ![]() |
![]() |
![]() |
| Calendar · Default (neutral, dark) | ![]() |
![]() |
![]() |
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
…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.






Stack: #9643 → #10031 → #9794 → #9653 → #9837 → #9842
This implements
spec:AST-111(approved in #9605) FR16 forDateInputandDateTimeInput.User need
After #9793, a phone user in a non-Gregorian calendar gets the Astryx bottom sheet, but it still shows Gregorian months, a 12-month wheel, and Gregorian years. A Hebrew user can't pick Adar I, an Ethiopic user can't reach Pagume, and a Japanese user sees no era.
Problem and solution fit
monthGeometry,MonthScroller).MonthYearWheels).令和8,1405 AP). As on iOS, a year that an era change splits takes its label and the heading's era from the date the wheels show: 2019 reads平成31with January selected and令和元with July, and January 3, 1989 heads昭和64年1月.TouchDateField,TouchDateTimeField).main'scalendarYearMonthOf, andcalendarMonthOfYearbuilds onmain'scalendarMonthFromYearMonthfor calendars that are not Gregorian-aligned. Gregorian-aligned calendars keep Gregorian year numbers inside the sheet's month model.MonthScrollerlays out each pane with the publicuseCalendarDays, passing the year and month numbers of its calendar month, since feat(Calendar): useCalendarDays and useCalendarNavigation take an optional calendar #10007 folded the internaluseCalendarMonthDaysinto it.Temporal.-u-ca-keyword in the provider locale does not select the calendar, so such a field keeps the Gregorian sheet;calendaron the component or the provider selects one.Current specification
spec:AST-111FR16 and FR3 (approved in spec(AST-111): date components use the calendar the application chooses #9605).component:DateInputFR21 andcomponent:DateTimeInputFR12. The sheet's weekday row follows main's DateInput FR19 (Calendar's weekday names). FR21 also says that in a month an era change splits, the heading follows the kept day while the pane's grid name keeps the era of the month's middle day.component:InternationalizationProviderFR10 and its Calendar row, andarchitecture:internationalizationINV10, now sayDateInputandDateTimeInputfollow the calendar on every surface; onlyDateRangeInputstays Gregorian. The provider's docs and JSDoc say the same and keepmain's statement that Timestamp, PowerSearch, and Lab's Schedule write their dates in the calendar.Public delta and caller burden
gregory/iso8601. No new props or types. Caller decisions: none.Design and alternatives
year * 12 + month, so existing behavior is unchanged. Other calendars count months from a fixed month withTemporal.Intlthrough the shared calendar helpers.Evidence
formatCalendarYearLabel, the era-change years behindcalendarYearSpansEras, and the kept-dayformatCalendarMonthLabelcases.Temporaltests: Buddhist and Japanese bottom sheets still show their years and eras.TemporalTemporalScreenshots
Chromium 149 with native Temporal unless noted. Phone shots use a mobile viewport with touch and a coarse pointer.
Scope
Testing
pnpm exec vitest run --maxWorkers=4over the MonthScroller, DateInput touch, calendar-presentation and no-Temporaltests andcalendarSystem.test.ts, withpackages/core/src/i18n,docPropLiterals.test.tsand the CLI core prop docs test, after the restack onto currentmain(with Lab's Schedule): 20 files, 324 tests passed. CI runs the full suites.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-native-fallback: 1,553 authored lines.core-dateinput--calendar-system-presentationsandcore-datetimeinput--calendar-systems. The coarse pointer isisMobile+hasTouch; Firefox uses theui.primaryPointerCapabilitiespref.Writing rubric results
component:DateInputcomponent:DateTimeInputcomponent:DateInputFR21. The Gregorian Date-panel gap was removed. The FR12 verification row keeps a missing warning for an explicitnativeamong its failures and adds a Date panel in another calendar.architecture:internationalizationDateRangeInputas the one date input that stays Gregorian.component:InternationalizationProviderDateRangeInputas the one component that stays Gregorian.