Repository navigation
feat(Calendar): weekday headers show abbreviated names where all seven fit in four characters - #9824
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report🔎 Preview ·
|
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| Calendar · Storybook | 54.0 kB (+299 B) · 10.4 kB CSS (0) | 1,693 (+35) | ✗ · ✓ · ✓ |
| DateTimeInput · Storybook | 167.8 kB (+302 B) · 17.1 kB CSS (0) | 3,637 (−7) | ✓ · ✓ · ✓ |
| DateRangeInput · Storybook | 71.5 kB (+273 B) · 11.9 kB CSS (0) | 666 (0) | ✓ · ✓ · ✓ |
6 more components
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| DateInput · Storybook | 147.1 kB (+261 B) · 15.4 kB CSS (0) | 5,002 (−8) | ✓ · ✓ · ✓ |
| PowerSearch | 235.6 kB (+229 B) · 21.7 kB CSS (0) | — | — · — · — |
| Timestamp | 21.3 kB (0) · 10.0 kB CSS (0) | — | — · — · — |
| lab/Comments | 258.3 kB (0) · 2.5 kB CSS (0) | — | — · — · — |
| lab/CommentThread | 253.1 kB (0) · 2.4 kB CSS (0) | — | — · — · — |
| lab/Schedule | 61.0 kB (0) · 3.9 kB CSS (0) | — | — · — · — |
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:
- @astryxdesign/cli 3.34 MB packed (−15 B); no new dependencies
- @astryxdesign/core 6.30 MB packed (+111 B); no new dependencies
API changes: none in this pull request
Committed API report behind this build: core 2 rows; run pnpm api:report.
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
There was a problem hiding this comment.
Approval waits on an engineering owner's decision on the new component:DateInput FR17 and the matching component:DateTimeInput FR3 sentence, which make the bottom sheets show Calendar's names; the Calendar header change itself matches component:Calendar DD1, and the regenerated table agrees with CLDR 48.2. An engineering owner records that decision by commenting /approve-spec cec9d83550bb2973c41d4e85388d76be7a83aaa7, and the author may do so as an engineering owner.
Whatever the decision, two fixes are needed:
- In a locale without a shipped catalog, such as
id-IDorhi-IN, the DateInput and DateTimeInput bottom sheets now show English weekday names under a localized month heading becausegetWeekdayHeaderNamesfalls back to English, so please keep a localized fallback there and test one such locale. - The lookup-and-rotate block from
useCalendarDaysis copied intoTouchDateField.tsxandTouchDateTimeField.tsx, so please let the shared resolver takeweekStartsOnand have all three callers make one call.
The before/after screenshots in the description are still placeholders (EVIDENCE_POPOVER, EVIDENCE_SHEET).
[Automated review]
| const dayNames = useMemo(() => { | ||
| const names = getWeekdayHeaderNames(locale); | ||
| return Array.from( | ||
| {length: 7}, | ||
| (_, offset) => names[(weekStartsOn + offset) % 7], | ||
| ); | ||
| }, [locale, weekStartsOn]); |
There was a problem hiding this comment.
For a locale without a generated row (id-ID, hi-IN, th-TH), getWeekdayHeaderNames returns English, so this row now reads Sun Mon Tue under a localized month heading where the base showed the locale's own names. This block also repeats the lookup and rotation in useCalendarDays.ts:116-122; a resolver that takes weekStartsOn would let all three callers make one call.
There was a problem hiding this comment.
Fixed in 3ebdb0b: getWeekdayHeaderNames(locale, weekStartsOn) now returns the rotated row, so all three callers make one call. A language with no generated row gets the platform's abbreviated names through the shared plainDate.ts formatter (id-ID shows Min Sen Sel), with tests on Calendar and both sheets.
| const dayNames = useMemo(() => { | ||
| const names = getWeekdayHeaderNames(locale); | ||
| return Array.from( | ||
| {length: 7}, | ||
| (_, offset) => names[(weekStartsOn + offset) % 7], | ||
| ); | ||
| }, [weekStartsOn, locale]); |
There was a problem hiding this comment.
Same as in TouchDateField.tsx: English names for a locale without a generated row, and a third copy of the lookup and rotation.
There was a problem hiding this comment.
Fixed in 3ebdb0b: getWeekdayHeaderNames(locale, weekStartsOn) now returns the rotated row, so all three callers make one call. A language with no generated row gets the platform's abbreviated names through the shared plainDate.ts formatter (id-ID shows Min Sen Sel), with tests on Calendar and both sheets.
|
/approve-spec 3ebdb0b |
3ebdb0b to
f015086
Compare
|
Rebased onto |
|
/approve-spec f015086 |
There was a problem hiding this comment.
Changes requested for one defect. The record text (the new component:Calendar DD1 sentence, component:DateInput FR19 and the component:DateTimeInput FR3 sentence) is approved for this head, and the Calendar and bottom-sheet names for the shipped locales match DD1.
getWeekdayHeaderNames.tsgives a locale with no shipped row its platform abbreviated names at any length, so in Calendar's 32px header columnssw-KE(Jumamosi),lv-LV(Ceturtd.) andfa-IR(چهارشنبه) overlap where the base was legible, which DD1's own reason rules out; please apply the generator's four-character test to the platform names, give a language that fails it a legible row (for example its CLDR short row), add a Calendar test for one such locale, and word the DD1 sentence and changeset to match.
A smaller, optional suggestion: the comment above sundayFirstNames can keep only its reason (see the inline note).
[Automated review]
| return ( | ||
| weekdayNamesByLocale[parsed.baseName] ?? | ||
| weekdayNamesByLocale[parsed.language] ?? | ||
| plainDateWeekdayNames(parsed.baseName) ?? |
There was a problem hiding this comment.
A language with no generated row gets the platform's abbreviated names here at any length. In Calendar's 32px header column, sw-KE (Jumamosi, 44px), lv-LV (Ceturtd., 39px) and fa-IR (چهارشنبه, 40px) overflow and overlap; the base showed English there. Applying the generator's four-grapheme test to these names, with a legible row for a language that fails it, keeps DD1's width rule for every locale.
There was a problem hiding this comment.
Fixed in ea79b18: an unshipped language's platform abbreviated names now pass the same four-character test (one shared constant, checked against the generator's in a test). A language that fails it gets the platform's narrow names, since Intl has no CLDR short width: sw-KE shows S M T, fa-IR ی د س. A Calendar test covers sw-KE, and the DD1 sentence and changeset say the same.
| /** | ||
| * Sunday-first names: the generated row for the exact locale or its language. | ||
| * A language with no generated row keeps its own words, so it gets the | ||
| * abbreviated names the platform formats. A malformed tag, or a language the | ||
| * platform does not know, gets English. | ||
| */ |
There was a problem hiding this comment.
Non-blocking (comment style): the first and last sentences restate the lookup chain below. Suggest keeping only: "A language with no generated row keeps its own words: the platform's abbreviated names."
|
/approve-spec ea79b18 |
There was a problem hiding this comment.
Changes requested for one defect. The weekday header names now follow component:Calendar DD1 in shipped and unshipped locales, and the record text is approved for this head.
- In a locale that falls back to narrow names (
sw-KEgivesS M T W T F S,lv-LVS P O T C P S), both bottom sheets key each weekday cell by its name (TouchDateField.tsx:1085,TouchDateTimeField.tsx:1140), so repeated names collide: React logs a duplicate-key error on every open in development, and onceweekStartsOnor the locale changes while the sheet is mounted the row grows to 9 cells out of line with the day columns; please key each cell by its day of week, as Calendar does, and add asw-KEsheet test that changesweekStartsOn.
[Automated review]
| return abbreviated; | ||
| } | ||
| return ( | ||
| plainDateWeekdayNames(parsed.baseName, 'narrow') ?? englishWeekdayNames |
There was a problem hiding this comment.
Narrow names repeat (sw-KE gives S M T W T F S), and both sheets render this row with key={name} (TouchDateField.tsx:1085, TouchDateTimeField.tsx:1140). The duplicate keys log a React error on open in development, and a weekStartsOn change while the sheet is open grows the row to 9 cells. Keying each cell by its day of week, as Calendar does at Calendar.tsx:1148, fixes it; a sw-KE sheet test that changes weekStartsOn would cover it.
There was a problem hiding this comment.
Fixed in 49da1eb: both sheets key each weekday cell by its day of week, as Calendar does. New sw-KE tests on the DateInput and DateTimeInput sheets change weekStartsOn while the sheet is open; they check the row stays seven aligned cells (M T W T F S S) and that React logs no duplicate key. Both tests fail without the fix.
There was a problem hiding this comment.
Changes requested for one finding. The duplicate weekday keys in the bottom sheets are fixed, and the record text (the new component:Calendar DD1 sentence, component:DateInput FR19 and the component:DateTimeInput FR3 sentence) is approved for this head.
- Both sheets now repeat Calendar's day-of-week pairing (
Calendar.tsx:864-871) atTouchDateField.tsx:723-731andTouchDateTimeField.tsx:661-669, beside the rotationgetWeekdayHeaderNamesalready does; please havegetWeekdayHeaderNames.tsreturn each name with its day of week (or add a sibling export there) so each sheet makes one call, and delete the two copies.
[Automated review]
| getWeekdayHeaderNames(locale, weekStartsOn).map((name, offset) => ({ | ||
| dayOfWeek: (weekStartsOn + offset) % 7, | ||
| name, | ||
| })), |
There was a problem hiding this comment.
This pairing repeats Calendar.tsx:864-871 and the same block in TouchDateTimeField.tsx:664-667, beside the rotation getWeekdayHeaderNames.ts:72 already does. If the resolver returned {dayOfWeek, name} (or a sibling export there did), this memo would be one call and the copy could go.
There was a problem hiding this comment.
Fixed in b713852: getWeekdayHeaderNames.ts exports getWeekdayHeaders(locale, weekStartsOn), which returns {dayOfWeek, name} for each column. Calendar and both sheets now make that one call, and the three pairing copies are gone (getWeekdayHeaderNames maps it to names for useCalendarDays).
| getWeekdayHeaderNames(locale, weekStartsOn).map((name, offset) => ({ | ||
| dayOfWeek: (weekStartsOn + offset) % 7, | ||
| name, | ||
| })), |
There was a problem hiding this comment.
Same pairing as TouchDateField.tsx:726-729 and Calendar.tsx:864-871; one export in getWeekdayHeaderNames.ts that returns each name with its day of week would serve all three.
There was a problem hiding this comment.
Fixed in b713852: getWeekdayHeaderNames.ts exports getWeekdayHeaders(locale, weekStartsOn), which returns {dayOfWeek, name} for each column. Calendar and both sheets now make that one call, and the three pairing copies are gone (getWeekdayHeaderNames maps it to names for useCalendarDays).
49da1eb to
b713852
Compare
|
Rebased onto |
There was a problem hiding this comment.
Recommending approval. Calendar's weekday headers now follow component:Calendar DD1 (abbreviated names where all seven fit in four characters, short names otherwise), and the DateInput and DateTimeInput bottom sheets show the same names. The record changes (the new DD1 sentence, DateInput FR19 and the DateTimeInput FR3 sentence) are approved for this head by an engineering owner.
- The earlier duplication is resolved:
getWeekdayHeaders(locale, weekStartsOn)gives Calendar and both sheets each column's day of week and name from one call. - The failing
typecheck,test-uiandtest-nodeCI jobs fail in code this pull request does not change (TokenizerBottomSheet.test.tsxand theuseLightboxandusePressPinlines of the CLI resolution fixture); the fixture line this pull request renames passes.
[Automated review]
…n fit in four characters
…viated ones run past four characters
…, since narrow names repeat
… its day of week for every caller
b713852 to
902b48a
Compare






Implements
component:CalendarDD1 (recorded in #9072) and applies it to the touch bottom sheets.User impact
Everyone who opens an Astryx date picker reads weekday column headers that are easier to tell apart:
Sun Mon Tue(wasSu Mo Tu), Frenchdim. lun.(wasdi lu), and the same for Spanish, Swedish, Norwegian, Romanian, Greek, Serbian, Turkish, German (So.becomesSo), and Traditional Chinese (日becomes週日).Min Sen Sel), else its narrow names (SwahiliS M T, Persianی د س), sinceIntlhas no short width.This covers Calendar and the popovers of DateInput, DateRangeInput, and DateTimeInput. The touch bottom sheets of DateInput and DateTimeInput used the abbreviated width in every locale, so Portuguese (Portugal) showed whole words (
domingo,segunda) that ran into each other. They now use the same names as Calendar, so Polish, Danish, Vietnamese, Arabic, and Hebrew also move to their short names there.Visual authority
DDrow reused or amended:component:CalendarDD1.Design decisionstable by a team design owner.docs/design/.Record changes in this PR:
component:Calendar: DD1's implementation gap is closed. The DD1 row, at-a-glance row, and Current-state impact drop the gap, and the DD1 verification row cites the new tests.component:DateInputFR19 (new): the bottom-sheet calendar's weekday row shows the names Calendar DD1 sets for the provider locale, in the panes' column order. A verification row, the Bottom-sheet calendar design row, and a non-goal bullet point to it.component:DateTimeInputFR3: the touch date sheet's weekday row followscomponent:DateInputFR19.Before and after
Real browser: Storybook with the neutral theme in light mode,
DateInputopened on November 2026. The before column ismain; the after column is this branch.Popover (
presentation="popover"):Bottom sheet (
presentation="bottom-sheet", 390×844 touch viewport):State matrix
en,fr-FR,de-DE,zh-TW(all change), pluspt-PTandpl-PL(short names kept, pixels unchanged).en(unchanged: it already showedSun),fr-FR(unchanged), andpt-PT(whole words becomedom. seg.).weekStartsOn: rotation is covered by unit tests on every surface.Scope
Testing
scripts/generate-cldr-weekdays.mjs): it now writesweekdayHeaderNames.generated.ts, choosing CLDR 48.2 stand-alone abbreviated names when all seven are at most four user-perceived characters and stand-alone short names otherwise.pnpm check:cldr-weekdayspasses, andgenerate-cldr-weekdays.test.mjsre-derives every locale from raw CLDR.getStandaloneShortWeekdayNamesbecomesgetWeekdayHeaderNames(locale, weekStartsOn), which returns the rotated row, souseCalendarDaysand both touch fields make one call. It looks up the exact locale, then its language. A language with no generated row gets the platform's abbreviated names when all seven are at most four characters, else its narrow names, through a new internalplainDateWeekdayNameshelper in the approvedplainDate.tsformatter module (architecture:internationalizationINV8). The runtime limit and the generator's limit are one value, and a test checks that they match. A malformed tag, or a language the platform does not know, gets English. The publicDATE_FORMAT_WEEKDAY_ONLYconstant is unchanged.DateInput.test.tsx,DateInputTouch.test.tsx,DateRangeInput.test.tsx,DateTimeInput.test.tsx,DateTimeInputTouch.test.tsx, and the generator test all pass. New cases: English,fr-FR(within the limit),pt-PT/pl-PL(above it),id-IDandsw-KE(no shipped data) on Calendar,id-IDon the DateInput sheet;en-US,pt-PT, andid-IDon the DateTimeInput sheet;plainDateWeekdayNamesinplainDate.test.ts.typecheck, ESLint on the changed files,pnpm check:knowledge,pnpm check:changesets, Prettier, andgit diff --checkall pass.Writing rubric results
Screenshots are retained on the
evidence/pr-9824-review-assetstag.