Skip to content

feat(Calendar): weekday headers show abbreviated names where all seven fit in four characters - #9824

Merged
imdreamrunner merged 4 commits into
mainfrom
feat/calendar-weekday-abbreviated
Nov 4, 2026
Merged

imdreamrunner merged 4 commits into
mainfrom
feat/calendar-weekday-abbreviated

Conversation

@imdreamrunner

@imdreamrunner imdreamrunner commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Implements component:Calendar DD1 (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:

  • Abbreviated names where all seven fit in four characters: English Sun Mon Tue (was Su Mo Tu), French dim. lun. (was di lu), and the same for Spanish, Swedish, Norwegian, Romanian, Greek, Serbian, Turkish, German (So. becomes So), and Traditional Chinese (日 becomes 週日).
  • Short names kept where an abbreviated name is longer: Portuguese (Portugal), Arabic, Hebrew, Polish, Danish, and Vietnamese show what they show today.
  • Unchanged: Brazilian Portuguese, Afrikaans, Catalan, Hungarian, Italian, Czech, Finnish, Dutch, Russian, Ukrainian, Simplified Chinese, Japanese, and Korean (both widths are the same).
  • Locales Astryx ships no translations for: Calendar showed English names. Calendar and the sheets now show the locale's own names under the same four-character rule: the platform's abbreviated names where all seven fit (Indonesian Min Sen Sel), else its narrow names (Swahili S M T, Persian ی د س), since Intl has 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

  • Existing component/module DD row reused or amended: component:Calendar DD1.
  • Durable component-local intent added to the optional Design decisions table by a team design owner.
  • Correction already settled by current family, design, theme, or objective accessibility authority.
  • New shared or cross-component direction settled in 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:DateInput FR19 (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:DateTimeInput FR3: the touch date sheet's weekday row follows component:DateInput FR19.

Before and after

Real browser: Storybook with the neutral theme in light mode, DateInput opened on November 2026. The before column is main; the after column is this branch.

Popover (presentation="popover"):

Popover weekday headers before and after

Bottom sheet (presentation="bottom-sheet", 390×844 touch viewport):

Bottom-sheet weekday headers before and after

State matrix

  • Popover: en, fr-FR, de-DE, zh-TW (all change), plus pt-PT and pl-PL (short names kept, pixels unchanged).
  • Bottom sheet: en (unchanged: it already showed Sun), fr-FR (unchanged), and pt-PT (whole words become dom. seg.).
  • weekStartsOn: rotation is covered by unit tests on every surface.
  • RTL, dark mode, themes: header typography, colour, and layout are untouched; only the text changes.

Scope

  • Appearance is the primary intent.
  • Behavior, API, interaction model, and unrelated layout changes were removed or split.
  • The evidence shows the changed pixels actively running, not only source or computed styles.
  • Public text and artifacts contain no internal Meta context.

Testing

  • Generator (scripts/generate-cldr-weekdays.mjs): it now writes weekdayHeaderNames.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-weekdays passes, and generate-cldr-weekdays.test.mjs re-derives every locale from raw CLDR.
  • Resolver: getStandaloneShortWeekdayNames becomes getWeekdayHeaderNames(locale, weekStartsOn), which returns the rotated row, so useCalendarDays and 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 internal plainDateWeekdayNames helper in the approved plainDate.ts formatter module (architecture:internationalization INV8). 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 public DATE_FORMAT_WEEKDAY_ONLY constant is unchanged.
  • Vitest: the Calendar folder, 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-ID and sw-KE (no shipped data) on Calendar, id-ID on the DateInput sheet; en-US, pt-PT, and id-ID on the DateTimeInput sheet; plainDateWeekdayNames in plainDate.test.ts.
  • Checks: core typecheck, ESLint on the changed files, pnpm check:knowledge, pnpm check:changesets, Prettier, and git diff --check all pass.
  • Visual regression: the touched Calendar and date-field baseline shots change in their header text, as intended. Baselines refresh through the normal capture after merge.

Writing rubric results

  • R1 narration: none; the closed gap leaves present-tense rows, and DateInput FR19 is stated as a requirement.
  • R2 research in the record: none.
  • R3 evidence naming a change: none; the verification rows name test cases.
  • R4 rejected alternatives over one line or outside a decision: none added.
  • R5 pull request or issue references remaining: none in the records.
  • R6 ruled open questions still listing options: none.

Screenshots are retained on the evidence/pr-9824-review-assets tag.

@vercel

vercel Bot commented Nov 3, 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 4, 2026 2:42am UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 3, 2026
@astracat-bot

astracat-bot Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🔄 In progress (for maintainers only) Nov 4, 2026, 2:32 AM UTC

@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 3, 2026
@github-actions

github-actions Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · 902b48a

Storybook · Sandbox · built from this PR's head

Modified components

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) before frame after frame diff frame
Calendar · Default (neutral, dark) before frame after frame diff frame

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

@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.

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-ID or hi-IN, the DateInput and DateTimeInput bottom sheets now show English weekday names under a localized month heading because getWeekdayHeaderNames falls back to English, so please keep a localized fallback there and test one such locale.
  • The lookup-and-rotate block from useCalendarDays is copied into TouchDateField.tsx and TouchDateTimeField.tsx, so please let the shared resolver take weekStartsOn and have all three callers make one call.

The before/after screenshots in the description are still placeholders (EVIDENCE_POPOVER, EVIDENCE_SHEET).

[Automated review]

Comment on lines +725 to +731
const dayNames = useMemo(() => {
const names = getWeekdayHeaderNames(locale);
return Array.from(
{length: 7},
(_, offset) => names[(weekStartsOn + offset) % 7],
);
}, [locale, weekStartsOn]);

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.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

Comment on lines +663 to +669
const dayNames = useMemo(() => {
const names = getWeekdayHeaderNames(locale);
return Array.from(
{length: 7},
(_, offset) => names[(weekStartsOn + offset) % 7],
);
}, [weekStartsOn, locale]);

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.

Same as in TouchDateField.tsx: English names for a locale without a generated row, and a third copy of the lookup and rotation.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

@imdreamrunner

Copy link
Copy Markdown
Contributor Author

/approve-spec 3ebdb0b

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 3, 2026
@imdreamrunner
imdreamrunner force-pushed the feat/calendar-weekday-abbreviated branch from 3ebdb0b to f015086 Compare November 3, 2026 23:23
@imdreamrunner

Copy link
Copy Markdown
Contributor Author

Rebased onto main, which added DateInput FR17 and FR18 for the sheet wheels, so this PR's bottom-sheet weekday rule is now FR19 (DateTimeInput FR3 points to it). No other change from f015086's parent content.

@imdreamrunner

Copy link
Copy Markdown
Contributor Author

/approve-spec f015086

@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.

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.ts gives a locale with no shipped row its platform abbreviated names at any length, so in Calendar's 32px header columns sw-KE (Jumamosi), lv-LV (Ceturtd.) and fa-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) ??

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.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

Comment on lines +22 to +27
/**
* 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.
*/

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.

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."

@imdreamrunner

Copy link
Copy Markdown
Contributor Author

/approve-spec ea79b18

@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.

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-KE gives S M T W T F S, lv-LV S 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 once weekStartsOn or 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 a sw-KE sheet test that changes weekStartsOn.

[Automated review]

return abbreviated;
}
return (
plainDateWeekdayNames(parsed.baseName, 'narrow') ?? englishWeekdayNames

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.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

github-actions Bot added a commit that referenced this pull request Nov 4, 2026
@github-actions github-actions Bot added the needs:design-review Affects visuals — Design should review label Nov 4, 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.

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) at TouchDateField.tsx:723-731 and TouchDateTimeField.tsx:661-669, beside the rotation getWeekdayHeaderNames already does; please have getWeekdayHeaderNames.ts return 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]

Comment on lines +726 to +729
getWeekdayHeaderNames(locale, weekStartsOn).map((name, offset) => ({
dayOfWeek: (weekStartsOn + offset) % 7,
name,
})),

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 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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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).

Comment on lines +664 to +667
getWeekdayHeaderNames(locale, weekStartsOn).map((name, offset) => ({
dayOfWeek: (weekStartsOn + offset) % 7,
name,
})),

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.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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).

github-actions Bot added a commit that referenced this pull request Nov 4, 2026
@imdreamrunner
imdreamrunner force-pushed the feat/calendar-weekday-abbreviated branch from 49da1eb to b713852 Compare November 4, 2026 01:02
@imdreamrunner

Copy link
Copy Markdown
Contributor Author

Rebased onto main. Since the private resolver module is renamed (getStandaloneShortWeekdayNames.ts → getWeekdayHeaderNames.ts), the CLI's recorded module resolutions (__fixtures__/resolutions/modules.txt) now list getWeekdayHeaderNames in its place. The useLightbox line in that fixture fails on main itself since the useLightbox docs landed (main CI has been red since then); this PR does not touch it.

@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.

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-ui and test-node CI jobs fail in code this pull request does not change (TokenizerBottomSheet.test.tsx and the useLightbox and usePressPin lines of the CLI resolution fixture); the fixture line this pull request renames passes.

[Automated review]

This branch was successfully deployed

1 active deployment
Preview — 902b48ae Deployed Nov 4, 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