An open source design system that's fully customizable and agent ready
TypeScript
fix(Calendar): a stand-alone month label starts with a capital where CLDR capitalizes one (#9371)
Cindy Zhangad2e378cb5a2
diff --git a/.changeset/calendar-standalone-month-capital.md b/.changeset/calendar-standalone-month-capital.mdnew file mode 100644index 0000000000..bb88bd0f0f--- /dev/null+++ b/.changeset/calendar-standalone-month-capital.md@@ -0,0 +1,7 @@+---+'@astryxdesign/core': patch+---++[fix] Calendar, DateInput, DateTimeInput: a month label that stands alone starts with a capital where the locale capitalizes one. In Spanish, French, Italian, Dutch, Polish, Russian and Ukrainian, Calendar's heading read "octubre de 2026"; it now reads "Octubre de 2026", following CLDR's stand-alone capitalization, as the weekday headers already use CLDR's stand-alone names. A two-month view capitalizes both months, and each month grid's name, the touch date fields' month headings and `useCalendarNavigation`'s `monthYearLabel` do the same. Dates in running text, such as a field's value, are unchanged, and so is every locale CLDR does not capitalize, Vietnamese included.++@cixzhangdiff --git a/docs/specs/components/Calendar/Calendar.spec.md b/docs/specs/components/Calendar/Calendar.spec.mdindex 58aee7aaa6..a057862941 100644--- a/docs/specs/components/Calendar/Calendar.spec.md+++ b/docs/specs/components/Calendar/Calendar.spec.md@@ -93,15 +93,15 @@ Consumer migration instructions belong in consumer docs and release notes.## Behavioral and layout contract-| ID | Invariant | Basis |-| --- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------- |-| FR1 | Each rendered month is one `role="grid"` named for its month and year, with a `columnheader` per weekday (and, with week numbers, a named `columnheader` above the `rowheader` column) and one `row` per week. Month and year labels and day names come from the provider locale. Day and week numbers MUST use the locale's digits (`architecture:internationalization` INV8). Implementation gap: they render as ASCII digits in every locale. | shipped source and focused tests; `architecture:internationalization` INV8 |-| FR2 | At most one day button in each month's grid holds `tabIndex={0}`; every other day button in that grid is `-1`. Each day button is the shared `sm` element size (inside an `md`-sized cell) as a minimum that grows with a set text size (`spec:AST-102` FR4). Implementation gap: the day buttons hold a fixed size. | shipped `useGridFocus` behavior; `Calendar.test.tsx` single-Tab-stop assertion; `spec:AST-102` FR4 |-| FR3 | A disabled day (outside bounds or rejected by a constraint) stays in the grid, stays focusable with `aria-disabled` and no native `disabled`, never holds the grid's Tab stop, and cannot be picked. Implementation gap: once a key move (arrow, Home, End, or Page key) has placed the Tab stop, it stays on that day when every day of the month becomes disabled (for example a range span cap in a two-month view). | `spec:AST-085` FR1, FR2; shipped source and focused tests |-| FR4 | In `range` mode the first pick starts the range and the second ends it, a second pick before the start swapping the two so the end never precedes the start; `minRangeSpan`/`maxRangeSpan` bound it. Escape, or picking the start day again when `minRangeSpan` is above 1, clears an in-progress range. | shipped source and focused tests |-| FR5 | Moving the focused day across a month boundary navigates the visible month so the focused day stays visible, in one month or two; a borrowed adjacent-month day is exposed `aria-disabled` and cannot be picked; arrow keys, Home and End skip it, and a page never lands on it. | shipped source and focused tests |-| FR6 | The month header shows the month and year between Previous and Next month buttons (ghost, icon-only Buttons whose chevrons mirror under RTL), which carry `calendar-nav` with `data-nav` and `data-disabled`. A button whose direction would leave `min` or `max` MUST stay focusable with `aria-disabled`, change nothing, and keep focus (`spec:AST-085` FR1, FR4). Implementation gap: it is natively disabled, so a focused button that reaches the bound drops focus. The month buttons are `component:Button`s, so their press scale MUST NOT apply under reduced motion (`design:reduced-motion` DR1). Implementation gap: it still applies under reduced motion. | `spec:AST-085`; shipped source and focused tests; `design:reduced-motion` DR1 |-| FR7 | When the visible month changes, by the month buttons, a Page key, an arrow across a month edge, or the handle, the new month (both months in a two-month view) is announced politely; the first render and a pick that leaves the month in place announce nothing. In `range` mode the first pick announces the start and prompts for an end, the second announces the completed range in chronological order, and picking the start again when `minRangeSpan` is above 1 announces the cleared start; Escape clears an in-progress range without an announcement. Every announcement uses the provider locale. | shipped source and focused tests |+| ID | Invariant | Basis |+| --- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- |+| FR1 | Each rendered month is one `role="grid"` named for its month and year, with a `columnheader` per weekday (and, with week numbers, a named `columnheader` above the `rowheader` column) and one `row` per week. Month and year labels and day names come from the provider locale. A month label that stands alone (the header, each grid's name, and `useCalendarNavigation`'s `monthYearLabel`) starts with a capital where CLDR's stand-alone context transform titlecases the month (`titlecase-firstword`); in a two-month view each month's label does. Day and week numbers MUST use the locale's digits (`architecture:internationalization` INV8). Implementation gap: they render as ASCII digits in every locale. | shipped source and focused tests; `architecture:internationalization` INV8 |+| FR2 | At most one day button in each month's grid holds `tabIndex={0}`; every other day button in that grid is `-1`. Each day button is the shared `sm` element size (inside an `md`-sized cell) as a minimum that grows with a set text size (`spec:AST-102` FR4). Implementation gap: the day buttons hold a fixed size. | shipped `useGridFocus` behavior; `Calendar.test.tsx` single-Tab-stop assertion; `spec:AST-102` FR4 |+| FR3 | A disabled day (outside bounds or rejected by a constraint) stays in the grid, stays focusable with `aria-disabled` and no native `disabled`, never holds the grid's Tab stop, and cannot be picked. Implementation gap: once a key move (arrow, Home, End, or Page key) has placed the Tab stop, it stays on that day when every day of the month becomes disabled (for example a range span cap in a two-month view). | `spec:AST-085` FR1, FR2; shipped source and focused tests |+| FR4 | In `range` mode the first pick starts the range and the second ends it, a second pick before the start swapping the two so the end never precedes the start; `minRangeSpan`/`maxRangeSpan` bound it. Escape, or picking the start day again when `minRangeSpan` is above 1, clears an in-progress range. | shipped source and focused tests |+| FR5 | Moving the focused day across a month boundary navigates the visible month so the focused day stays visible, in one month or two; a borrowed adjacent-month day is exposed `aria-disabled` and cannot be picked; arrow keys, Home and End skip it, and a page never lands on it. | shipped source and focused tests |+| FR6 | The month header shows the month and year between Previous and Next month buttons (ghost, icon-only Buttons whose chevrons mirror under RTL), which carry `calendar-nav` with `data-nav` and `data-disabled`. A button whose direction would leave `min` or `max` MUST stay focusable with `aria-disabled`, change nothing, and keep focus (`spec:AST-085` FR1, FR4). Implementation gap: it is natively disabled, so a focused button that reaches the bound drops focus. The month buttons are `component:Button`s, so their press scale MUST NOT apply under reduced motion (`design:reduced-motion` DR1). Implementation gap: it still applies under reduced motion. | `spec:AST-085`; shipped source and focused tests; `design:reduced-motion` DR1 |+| FR7 | When the visible month changes, by the month buttons, a Page key, an arrow across a month edge, or the handle, the new month (both months in a two-month view) is announced politely; the first render and a pick that leaves the month in place announce nothing. In `range` mode the first pick announces the start and prompts for an end, the second announces the completed range in chronological order, and picking the start again when `minRangeSpan` is above 1 announces the cleared start; Escape clears an in-progress range without an announcement. Every announcement uses the provider locale. | shipped source and focused tests |### Allowed variation@@ -211,6 +211,7 @@ button.| AR1 | `Calendar.test.tsx` ("has accessible grid structure", "sets aria-multiselectable on both grids in a two-month range view", "does not set aria-multiselectable in single mode", "announces the new month politely when clicking next", "displays day names") and `useGridFocus.test.tsx` ("ArrowDown moves the tab stop one row down", "flips ArrowLeft/ArrowRight under RTL"); `Calendar.test.tsx` "ArrowUp skips a disabled cell in the same column to the next enabled row (complex-2)" for the disabled-day skip; `Calendar.test.tsx` Page-key cases ("moves the focused day by a month with PageDown and PageUp, into the month now shown", "pages from a borrowed adjacent-month day onto the real day in the month already shown", "an arrow past max changes nothing and leaves no pending target behind", "a page into a month with no enabled day changes nothing and keeps focus", "a page onto a day disabled by a constraint moves the month and focuses its first enabled day", "a page whose target lies past max changes nothing and keeps focus", "in a two-month view a boundary blocks only out-of-range targets, not month movement", "in a two-month view PageDown from the second month moves both months and a later Next click selects no stale day"); borrowed-day cases ("skips borrowed adjacent-month days and crosses into their month instead", "in a two-month view an arrow from the first month lands on the real day, never a borrowed one", "an arrow toward a direction where every remaining day is disabled changes nothing", "an arrow resolves the next enabled day in its direction first: weekdays-only ArrowRight from Friday January 30 reaches Monday February 2", "an arrow whose next day in range does not exist changes nothing: max January 25, ArrowDown from January 21"); the single-Tab-stop assertion in the AST-085 range-cap case (FR2). `Calendar.test.tsx` selection-state accessible-name cases ("appends 'selected' to the selected day's button name in single mode", "marks range start, end, and in-range days in their accessible names"). Evidence gap: no Calendar-level test of Home, End, Enter, or Space; no test covers the Tab stop after a key move followed by a pointer pick or a fully disabled month | LTR and RTL; month boundary; selected, today, disabled days | A day loses its role, name or state, two days in one month hold a Tab stop, or an arrow, Home/End, Page or activation key stops moving or picking. | `audit:Calendar/accessibility` || FR6 | `Calendar.test.tsx` navigation, bound, theming-target ("renders the astryx-calendar-nav target on both month-nav buttons", "reflects the disabled nav state as a data attribute at the range edges", "keeps the default nav rendering unchanged (still a ghost icon button)"), and RTL month-navigation cases | Previous and Next; at `min` and `max`; `dir="rtl"` | A button enabled past a bound, a missing `calendar-nav` target or state attribute, or a lost shared chevron wrapper fails. Evidence gap: no test asserts focus kept at a bound (the FR6 gap), the mirrored chevron pixels, or the press under reduced motion. | `audit:Calendar/behavior` || FR7 | `Calendar.test.tsx` month-change announcement cases ("does not announce on initial render", "announces the new month politely when clicking next", "announces the next month when paging the grid with PageDown", "announces both months in a two-month view", "does not announce when selecting a date leaves the visible month unchanged") and range announcement cases ("announces the start pick and prompts for an end date", "announces the completed range in chronological order for a reverse pick") | Month buttons, Page keys, handle; single and two months; range start, complete, cleared | A missing, extra, or out-of-order announcement fails. Evidence gap: no test reaches the cleared-start announcement (the cleared-range case sets no `minRangeSpan`). | `audit:Calendar/accessibility` |+| FR1 (labels) | `Calendar.test.tsx` ("starts each stand-alone month label with a capital in %s", "leaves the month label as Intl gives it where CLDR does not capitalize in %s"), `plainDate.test.ts` `plainDateFormatStandaloneMonthYear` | es, fr, pl, ru two-month view; vi, de, en | A lower-case stand-alone month where CLDR titlecases it, a capital where it does not, or a second month left lower case fails. | `audit:Calendar/behavior` || FR2 (size) | Evidence gap: no test asserts day-button size or text growth | — | — | `audit:Calendar/layout` || AR1 (browser) | `Calendar.a11y.test.tsx` and `Calendar.a11y.chromium.spec.ts` over the shared grid states | Every representative state | A lost grid name, role, or start neighbourhood fails; browser-owned outcomes are reported. | `audit:Calendar/accessibility` || ORD1, ORD2, PR1 | ORD1 and ORD2 are covered by the FR3–FR5 and AR1 rows. Evidence gap: no test asserts the absence of per-cell listeners | — | — | `audit:Calendar/behavior` |diff --git a/docs/specs/components/DateInput/DateInput.spec.md b/docs/specs/components/DateInput/DateInput.spec.mdindex ea0178fed0..ea228ad56e 100644--- a/docs/specs/components/DateInput/DateInput.spec.md+++ b/docs/specs/components/DateInput/DateInput.spec.md@@ -126,7 +126,7 @@ Consumer migration instructions belong in consumer docs and release notes.| FR3 | Explicit `presentation` MUST outrank deprecated `nativePicker`; the legacy values MUST retain their mappings and development-only warning from `spec:AST-043/FR3–FR4`. | Current source, docs, and Presentation tests || FR4 | Adaptive resolution MUST use the primary pointer rather than viewport width or any-pointer availability, so tablets receive a touch surface and touchscreen laptops retain the typable field. | Current source, consumer docs, and surface-selection tests || FR5 | Text, Calendar, bottom-sheet, and native commit paths MUST enforce `min`, `max`, and `dateConstraints`; a rejected value MUST NOT replace the controlled value. | Current source and all four focused suites |-| FR6 | Named committed formats MUST follow the InternationalizationProvider locale and shared Timestamp vocabulary; formatting MUST NOT rewrite in-progress typed text. Typed text MUST parse in the provider locale (`architecture:internationalization` INV1a, INV8). Implementation gap: the typed parser accepts only English month names and ASCII digits, using the locale only to order day and month. | `architecture:internationalization`; current source, docs, locale tests; `spec:AST-043/FR5` |+| FR6 | Named committed formats MUST follow the InternationalizationProvider locale and shared Timestamp vocabulary; formatting MUST NOT rewrite in-progress typed text. Typed text MUST parse in the provider locale (`architecture:internationalization` INV1a, INV8). The touch sheet's month heading and each month pane's name are stand-alone month labels: they start with a capital where CLDR's stand-alone context transform titlecases the month, as `component:Calendar` FR1 states for Calendar's. Implementation gap: the typed parser accepts only English month names and ASCII digits, using the locale only to order day and month. | `architecture:internationalization`; current source, docs, locale tests; `spec:AST-043/FR5` || FR7 | Every value-change path MUST call `onChange` before `changeAction`, present the proposed value optimistically, and expose one busy state while the Action is pending. | `family:input-fields/FR6`; current source and focused tests || FR8 | The pointer field MUST open its Calendar from the input, calendar toggle, ArrowDown, or Alt+ArrowDown; Popover dismissal and focus return MUST remain owned by the shared Popover path. | Current source, Popover composition, keyboard/focus tests || FR9 | A pointer-surface Calendar selection MUST commit and close its Popover; a bottom-sheet Calendar selection MUST remain editable in the open sheet until Save closes the surface. | Current source and pointer/touch tests |diff --git a/docs/specs/components/DateTimeInput/DateTimeInput.spec.md b/docs/specs/components/DateTimeInput/DateTimeInput.spec.mdindex 2d050794f5..17f7225df6 100644--- a/docs/specs/components/DateTimeInput/DateTimeInput.spec.md+++ b/docs/specs/components/DateTimeInput/DateTimeInput.spec.md@@ -111,7 +111,7 @@ Consumer migration instructions belong in consumer docs and release notes.| --- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------- || FR1 | DateTimeInput MUST reflect one controlled date-time value across its visible segments and active picker, and MUST NOT reveal a competing selected date after the parent accepts a clear. | Public docs, controlled component seam, current source, focused tests || FR2 | Every committed date or time change MUST emit one valid combined ISO date-time value; clearing MUST emit `undefined`; changing time while no date is committed MUST emit nothing. | Public types, docs, current source, focused tests |-| FR3 | `presentation`, deprecated `nativePicker`, precedence, pointer adaptation, forced surfaces, and per-segment native fallbacks MUST follow `spec:AST-043` FR1–FR4. | `spec:AST-043` |+| FR3 | `presentation`, deprecated `nativePicker`, precedence, pointer adaptation, forced surfaces, and per-segment native fallbacks MUST follow `spec:AST-043` FR1–FR4. The touch date sheet's month heading and month-pane names follow `component:DateInput` FR6. | `spec:AST-043` || FR4 | When `changeAction` is present, every value-change path MUST call `onChange` first, show the proposed controlled value optimistically, and contribute to one busy state until the controlled value accepts or replaces it. | `family:input-fields/FR6` || FR5 | The two pointer segments share one row while each retains its intrinsic basis; when the container is narrower, flex wrapping moves them into separate full-width rows. Each segment is the shared element height for its size, as a minimum that grows with a set text size under `spec:AST-102` FR4. Implementation gap: the height is fixed at that size. | Public docs, current source, focused layout tests; `spec:AST-102` FR4 || FR6 | Date-time bounds and date constraints MUST prevent invalid commits. Native controls MAY receive platform hints, but JavaScript validation remains the final commit boundary; calendar-only options MAY be unavailable on native surfaces. | Public docs, current source, focused presentation tests |diff --git a/package.json b/package.jsonindex 852a83a49d..2ed6bccaa2 100644--- a/package.json+++ b/package.json@@ -36,11 +36,13 @@"storyboards": "playwright test --config playwright.interaction.config.ts --grep @storyboard","typecheck": "pnpm -r --no-bail --workspace-concurrency=1 --if-present --filter \"!@astryxdesign/docsite\" --filter \"!@astryxdesign/sandbox\" run typecheck","check:package-boundaries": "node scripts/check-package-boundaries.js",- "check:repo": "pnpm check:visual-owner && pnpm check:sync && pnpm check:neutral-palette-refs && pnpm check:stone-palette-refs && pnpm check:gothic-palette-refs && pnpm check:matcha-palette-refs && pnpm check:butter-palette-refs && pnpm check:y2k-palette-refs && pnpm check:data-tokens && pnpm check:token-docs && pnpm check:knowledge && pnpm check:package-boundaries && pnpm check:changesets && pnpm check:demo-media && pnpm check:executable-bits && pnpm check:cli-structure && pnpm check:use-client && pnpm check:portable-scripts && pnpm check:i18n-runtime && pnpm check:i18n-catalog && pnpm check:cldr-weekdays && pnpm check:fixtures && pnpm check:setup-contract",+ "check:repo": "pnpm check:visual-owner && pnpm check:sync && pnpm check:neutral-palette-refs && pnpm check:stone-palette-refs && pnpm check:gothic-palette-refs && pnpm check:matcha-palette-refs && pnpm check:butter-palette-refs && pnpm check:y2k-palette-refs && pnpm check:data-tokens && pnpm check:token-docs && pnpm check:knowledge && pnpm check:package-boundaries && pnpm check:changesets && pnpm check:demo-media && pnpm check:executable-bits && pnpm check:cli-structure && pnpm check:use-client && pnpm check:portable-scripts && pnpm check:i18n-runtime && pnpm check:i18n-catalog && pnpm check:cldr-weekdays && pnpm check:cldr-month-capitals && pnpm check:fixtures && pnpm check:setup-contract","check:visual-owner": "node scripts/check-visual-workflow-owner.mjs","check:fixtures": "node internal/vibe-tests/scripts/fixture-suite.mjs verify","generate:cldr-weekdays": "node scripts/generate-cldr-weekdays.mjs","check:cldr-weekdays": "node scripts/generate-cldr-weekdays.mjs --check",+ "generate:cldr-month-capitals": "node scripts/generate-cldr-month-capitals.mjs",+ "check:cldr-month-capitals": "node scripts/generate-cldr-month-capitals.mjs --check","check:changesets": "node scripts/check-changesets.mjs","check:portable-scripts": "node scripts/check-portable-scripts.mjs","check:cli-structure": "node scripts/check-cli-structure.mjs",@@ -117,6 +119,7 @@"chokidar": "^4.0.3","cldr-core": "^48.2.0","cldr-dates-full": "^48.2.0",+ "cldr-misc-full": "^48.2.0","dom-accessibility-api": "^0.6.3","esbuild": "catalog:","eslint": "^10.6.0",diff --git a/packages/core/src/Calendar/Calendar.test.tsx b/packages/core/src/Calendar/Calendar.test.tsxindex 5271f7429b..a4c20a6b67 100644--- a/packages/core/src/Calendar/Calendar.test.tsx+++ b/packages/core/src/Calendar/Calendar.test.tsx@@ -209,15 +209,55 @@ describe('Calendar', () => {expect(screen.getByText('January 2026')).toBeInTheDocument();rerender(renderCalendar('es-ES'));- expect(screen.getByText('enero de 2026')).toBeInTheDocument();+ expect(screen.getByText('Enero de 2026')).toBeInTheDocument();const nextButton =document.querySelector<HTMLButtonElement>('[data-nav="next"]');expect(nextButton).not.toBeNull();await user.click(nextButton!);- expect(screen.getByText('febrero de 2026')).toBeInTheDocument();+ expect(screen.getByText('Febrero de 2026')).toBeInTheDocument();});+ it.each([+ ['es-ES', 'Octubre de 2026', 'Noviembre de 2026'],+ ['fr-FR', 'Octobre 2026', 'Novembre 2026'],+ ['pl-PL', 'Październik 2026', 'Listopad 2026'],+ ['ru-RU', 'Октябрь 2026 г.', 'Ноябрь 2026 г.'],+ ])(+ 'starts each stand-alone month label with a capital in %s',+ (locale, october, november) => {+ render(+ <InternationalizationProvider locale={locale}>+ <Calendar mode="range" numberOfMonths={2} focusDate="2026-10-01" />+ </InternationalizationProvider>,+ );+ // The heading names both months, each capitalized (FR1).+ expect(screen.getByText(`${october} – ${november}`)).toBeInTheDocument();+ // Each grid's name is the same stand-alone label.+ expect(+ screen+ .getAllByRole('grid')+ .map(grid => grid.getAttribute('aria-label')),+ ).toEqual([october, november]);+ },+ );++ it.each([+ ['vi-VN', 'tháng 10 năm 2026'],+ ['de-DE', 'Oktober 2026'],+ ['en-US', 'October 2026'],+ ])(+ 'leaves the month label as Intl gives it where CLDR does not capitalize in %s',+ (locale, label) => {+ render(+ <InternationalizationProvider locale={locale}>+ <Calendar focusDate="2026-10-01" />+ </InternationalizationProvider>,+ );+ expect(screen.getByText(label)).toBeInTheDocument();+ },+ );+it('displays correct number of day cells', () => {render(<Calendar />);diff --git a/packages/core/src/Calendar/Calendar.tsx b/packages/core/src/Calendar/Calendar.tsxindex 79b92b41ee..a21a514b94 100644--- a/packages/core/src/Calendar/Calendar.tsx+++ b/packages/core/src/Calendar/Calendar.tsx@@ -60,8 +60,8 @@ import {plainDateFormat,plainDateWeekFieldName,DATE_FORMAT_WITH_WEEKDAY,- DATE_FORMAT_MONTH_YEAR,} from '../utils/plainDate';+import {plainDateFormatStandaloneMonthYear} from '../utils/plainDate';import {mergeProps, composeEventHandlers, rtlStyles} from '../utils';import {focusOutlineProps} from '../utils/focusOutline.stylex';import {interactionOverlayStyles} from '../utils/interactionOverlay.stylex';@@ -389,14 +389,15 @@ export function Calendar({ref, ...props}: CalendarProps) {);// Format month header- const monthYearLabel = useMemo(() => {- if (numberOfMonths === 1) {- return plainDateFormat(visibleMonths[0], DATE_FORMAT_MONTH_YEAR, locale);- }- return visibleMonths- .map(m => plainDateFormat(m, DATE_FORMAT_MONTH_YEAR, locale))- .join(' – ');- }, [visibleMonths, numberOfMonths, locale]);+ // Each month is its own stand-alone label, so each starts with a capital+ // where the locale capitalizes one (FR1).+ const monthYearLabel = useMemo(+ () =>+ visibleMonths+ .map(m => plainDateFormatStandaloneMonthYear(m, locale))+ .join(' – '),+ [visibleMonths, locale],+ );// Announce the newly visible month to screen readers whenever it changes.// The visible month label (`<span>`) carries no live semantics, so paging the@@ -1087,7 +1088,7 @@ function MonthGrid({// Month label for announcementsconst monthLabel = useMemo(() => {- return plainDateFormat(month, DATE_FORMAT_MONTH_YEAR, locale);+ return plainDateFormatStandaloneMonthYear(month, locale);}, [month, locale]);return (diff --git a/packages/core/src/Calendar/hooks/useCalendarNavigation.ts b/packages/core/src/Calendar/hooks/useCalendarNavigation.tsindex 04f7311de7..000ddf15b6 100644--- a/packages/core/src/Calendar/hooks/useCalendarNavigation.ts+++ b/packages/core/src/Calendar/hooks/useCalendarNavigation.ts@@ -22,9 +22,8 @@ import {plainDateSetFirstOfMonth,plainDateAddMonths,plainDateAddDays,- plainDateFormat,- DATE_FORMAT_MONTH_YEAR,} from '../../utils/plainDate';+import {plainDateFormatStandaloneMonthYear} from '../../utils/plainDate';import {useLocale} from '../../i18n';/**@@ -135,14 +134,14 @@ export function useCalendarNavigation(}, [baseMonth, numberOfMonths]);// Format month header- const monthYearLabel = useMemo(() => {- if (numberOfMonths === 1) {- return plainDateFormat(visibleMonths[0], DATE_FORMAT_MONTH_YEAR, locale);- }- return visibleMonths- .map(m => plainDateFormat(m, DATE_FORMAT_MONTH_YEAR, locale))- .join(' – ');- }, [visibleMonths, numberOfMonths, locale]);+ // Each month is its own stand-alone label (Calendar FR1).+ const monthYearLabel = useMemo(+ () =>+ visibleMonths+ .map(m => plainDateFormatStandaloneMonthYear(m, locale))+ .join(' – '),+ [visibleMonths, locale],+ );// Navigate to previous/next monthconst navigateMonth = useCallback(diff --git a/packages/core/src/DateInput/DateInputTouch.test.tsx b/packages/core/src/DateInput/DateInputTouch.test.tsxindex 6564c6774f..f1719242ef 100644--- a/packages/core/src/DateInput/DateInputTouch.test.tsx+++ b/packages/core/src/DateInput/DateInputTouch.test.tsx@@ -451,11 +451,14 @@ describe('DateInput — surface selection', () => {expect(pane('March 2026')).toBeInTheDocument();rerender(renderDateInput('es-ES'));+ // The field's date is running text; the sheet's month heading and each+ // month pane's name stand alone, so they start with a capital+ // (Calendar FR1).expect(field()).toHaveValue('21 de marzo de 2026');expect(document.querySelector('[data-title="month-year"]'),- ).toHaveTextContent('marzo de 2026');- expect(pane('marzo de 2026')).toBeInTheDocument();+ ).toHaveTextContent('Marzo de 2026');+ expect(pane('Marzo de 2026')).toBeInTheDocument();const nextButton = document.querySelector<HTMLButtonElement>('[data-arrows="months"] button:last-child',@@ -464,7 +467,7 @@ describe('DateInput — surface selection', () => {fireEvent.click(nextButton!);expect(document.querySelector('[data-title="month-year"]'),- ).toHaveTextContent('abril de 2026');+ ).toHaveTextContent('Abril de 2026');});});diff --git a/packages/core/src/DateInput/MonthScroller.tsx b/packages/core/src/DateInput/MonthScroller.tsxindex f8691550fc..0ccac41f73 100644--- a/packages/core/src/DateInput/MonthScroller.tsx+++ b/packages/core/src/DateInput/MonthScroller.tsx@@ -50,6 +50,7 @@ import {borderVars,} from '../theme/tokens.stylex';import {focusOutlineStyles} from '../utils';+import {plainDateFormatStandaloneMonthYear} from '../utils/plainDate';import {type DayOfWeek,type ISODateString,@@ -59,7 +60,6 @@ import {plainDateFormat,plainDateIsEqual,plainDateToISO,- DATE_FORMAT_MONTH_YEAR,DATE_FORMAT_WITH_WEEKDAY,} from '../utils';import {dateInputTouchSizes, dateInputTouchGeometry} from './tokens.stylex';@@ -866,9 +866,8 @@ function MonthPane({hasVariableRowCount: false,});- const monthLabel = plainDateFormat(+ const monthLabel = plainDateFormatStandaloneMonthYear({year, month, day: 1},- DATE_FORMAT_MONTH_YEAR,locale,);diff --git a/packages/core/src/DateInput/TouchDateField.tsx b/packages/core/src/DateInput/TouchDateField.tsxindex 18209cb856..7a6f53c2ed 100644--- a/packages/core/src/DateInput/TouchDateField.tsx+++ b/packages/core/src/DateInput/TouchDateField.tsx@@ -108,10 +108,10 @@ import {plainDateFromISO,plainDateToday,plainDateFormat,- DATE_FORMAT_MONTH_YEAR,DATE_FORMAT_WEEKDAY_ONLY,type ISODateString,} from '../utils';+import {plainDateFormatStandaloneMonthYear} from '../utils/plainDate';import {chainEventHandlers} from '../utils/chainEventHandlers';import {interactionOverlayStyles} from '../utils/interactionOverlay.stylex';import {usePressFeedback} from '../hooks/usePressFeedback';@@ -754,9 +754,8 @@ export function TouchDateField({),[locale, weekStartsOn],);- const monthYearLabel = plainDateFormat(+ const monthYearLabel = plainDateFormatStandaloneMonthYear({year, month, day: 1},- DATE_FORMAT_MONTH_YEAR,locale,);diff --git a/packages/core/src/DateTimeInput/TouchDateTimeField.tsx b/packages/core/src/DateTimeInput/TouchDateTimeField.tsxindex e4efec2eb7..00418f5dc5 100644--- a/packages/core/src/DateTimeInput/TouchDateTimeField.tsx+++ b/packages/core/src/DateTimeInput/TouchDateTimeField.tsx@@ -84,13 +84,13 @@ import {chainEventHandlers} from '../utils/chainEventHandlers';import {joinAriaIDs} from '../utils/inputAria';import {DATE_FORMAT_LONG,- DATE_FORMAT_MONTH_YEAR,DATE_FORMAT_WEEKDAY_ONLY,plainDateFormat,plainDateFromISO,plainDateToday,type PlainDate,} from '../utils/plainDate';+import {plainDateFormatStandaloneMonthYear} from '../utils/plainDate';import {MonthScroller,type MonthScrollerHandle,@@ -672,9 +672,8 @@ export function TouchDateTimeField({),[weekStartsOn, locale],);- const monthYearLabel = plainDateFormat(+ const monthYearLabel = plainDateFormatStandaloneMonthYear({year, month, day: 1},- DATE_FORMAT_MONTH_YEAR,locale,);diff --git a/packages/core/src/utils/plainDate.test.ts b/packages/core/src/utils/plainDate.test.tsindex abf48f7ddd..7e39afd63d 100644--- a/packages/core/src/utils/plainDate.test.ts+++ b/packages/core/src/utils/plainDate.test.ts@@ -28,6 +28,7 @@ import {plainDateSetEndOfWeekExclusive,plainDateGetWeekNumber,plainDateFormat,+ plainDateFormatStandaloneMonthYear,formatSharedDate,DATE_FORMAT_LONG,DATE_FORMAT_WITH_WEEKDAY,@@ -755,6 +756,31 @@ describe('plainDateGetWeekNumber', () => {});});+describe('plainDateFormatStandaloneMonthYear', () => {+ const october = {year: 2026, month: 10, day: 1};++ it.each([+ ['es-ES', 'Octubre de 2026'],+ ['fr-FR', 'Octobre 2026'],+ ['it-IT', 'Ottobre 2026'],+ ['nl-NL', 'Oktober 2026'],+ ['pl-PL', 'Październik 2026'],+ ['ru-RU', 'Октябрь 2026 г.'],+ ['uk-UA', 'Жовтень 2026 р.'],+ ['es-MX', 'Octubre de 2026'],+ ])('capitalizes the stand-alone month in %s', (locale, label) => {+ expect(plainDateFormatStandaloneMonthYear(october, locale)).toBe(label);+ });++ it.each([+ ['vi-VN', 'tháng 10 năm 2026'],+ ['en-US', 'October 2026'],+ ['pt-BR', 'outubro de 2026'],+ ])('keeps the Intl label in %s', (locale, label) => {+ expect(plainDateFormatStandaloneMonthYear(october, locale)).toBe(label);+ });+});+describe('plainDateFormat', () => {it('keeps one formatter per locale and options, whatever order the options are in', () => {// A month of day labels, as a calendar renders them, reuses one formatter.diff --git a/packages/core/src/utils/plainDate.ts b/packages/core/src/utils/plainDate.tsindex be69bcf984..138400ccb8 100644--- a/packages/core/src/utils/plainDate.ts+++ b/packages/core/src/utils/plainDate.ts@@ -9,6 +9,8 @@import type {ISODateString, PlainDate} from './dateTypes';import type {Locale} from '../i18n/types';+import {firstCharacter} from './characters';+import {standaloneMonthCapitalLanguages} from './standaloneMonthCapitals.generated';export type {PlainDate} from './dateTypes';@@ -329,6 +331,32 @@ export const DATE_FORMAT_MONTH_YEAR: Intl.DateTimeFormatOptions = {month: 'long',};+/**+ * The month and year as a label that stands alone, such as a calendar heading+ * or a month grid's name. `Intl` formats the month for running text; where+ * CLDR titlecases a stand-alone month name (its `contextTransforms`), the+ * label starts with a capital, as Calendar's weekday headers use CLDR's+ * stand-alone forms (`component:Calendar` FR1). Internal: not re-exported from+ * `utils/index.ts`.+ */+export function plainDateFormatStandaloneMonthYear(+ pd: PlainDate,+ locale: Locale,+): string {+ const label = plainDateFormat(pd, DATE_FORMAT_MONTH_YEAR, locale);+ let language: string;+ try {+ language = new Intl.Locale(locale).language;+ } catch {+ return label;+ }+ if (!standaloneMonthCapitalLanguages.has(language)) {+ return label;+ }+ const first = firstCharacter(label);+ return first.toLocaleUpperCase(locale) + label.slice(first.length);+}+// e.g. "Sun" (locale-dependent) — the weekday on its own, abbreviated.//// This is CLDR's `abbreviated` width, which `Intl` reaches natively. Notediff --git a/packages/core/src/utils/standaloneMonthCapitals.generated.ts b/packages/core/src/utils/standaloneMonthCapitals.generated.tsnew file mode 100644index 0000000000..7ecd12307a--- /dev/null+++ b/packages/core/src/utils/standaloneMonthCapitals.generated.ts@@ -0,0 +1,17 @@+// Copyright (c) Meta Platforms, Inc. and affiliates.++/**+ * @generated by scripts/generate-cldr-month-capitals.mjs from Unicode CLDR 48.2.0.+ * Do not edit by hand. Run `pnpm generate:cldr-month-capitals` instead.+ */++/** Shipped languages whose stand-alone month names start with a capital. */+export const standaloneMonthCapitalLanguages: ReadonlySet<string> = new Set([+ 'es',+ 'fr',+ 'it',+ 'nl',+ 'pl',+ 'ru',+ 'uk',+]);diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 42294168aa..c2f0081627 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -113,6 +113,9 @@ importers:cldr-dates-full:specifier: ^48.2.0version: 48.2.0([email protected]([email protected]))+ cldr-misc-full:+ specifier: ^48.2.0+ version: 48.2.0([email protected])dom-accessibility-api:specifier: ^0.6.3version: 0.6.3@@ -4417,6 +4420,11 @@ packages:peerDependencies:cldr-numbers-full: 48.2.0+ resolution: {integrity: sha512-dSc2Tr53dQcUGwsTinamEeoP2YXOhQrIZ+SyeuUrv4MzJOSjT/Q0qkSmX11ZwfcTbYSkIqbrgALQLhAm1yf5fA==}+ peerDependencies:+ cldr-core: 48.2.0+resolution: {integrity: sha512-0EQ+UkVDsyXOlxnWnL1RIENVZFqCnb04D1Yrku0obnOyttbuZz8tHmUd5c5AEvhGS/Gg2zI4fTaCm51LSGITog==}peerDependencies:@@ -10392,6 +10400,10 @@ snapshots:dependencies:cldr-numbers-full: 48.2.0([email protected])+ dependencies:+ cldr-core: 48.2.0+dependencies:cldr-core: 48.2.0diff --git a/scripts/generate-cldr-month-capitals.mjs b/scripts/generate-cldr-month-capitals.mjsnew file mode 100644index 0000000000..a559196fab--- /dev/null+++ b/scripts/generate-cldr-month-capitals.mjs@@ -0,0 +1,99 @@+// Copyright (c) Meta Platforms, Inc. and affiliates.++/**+ * Generates the languages whose stand-alone month names start with a capital.+ *+ * CLDR records capitalization per context in `contextTransforms`: a language+ * whose `month-standalone-except-narrow` stand-alone value is+ * `titlecase-firstword` capitalizes a month name that stands alone, such as a+ * calendar heading, though `Intl.DateTimeFormat` formats it for running text.+ * The runtime package consumes only the checked-in TypeScript output; raw CLDR+ * data stays in root development dependencies and is read only by this script.+ */++import fs from 'node:fs';+import path from 'node:path';+import {createRequire} from 'node:module';+import {fileURLToPath, pathToFileURL} from 'node:url';+import {format, resolveConfig} from 'prettier';+import {getShippedLocales} from './generate-cldr-weekdays.mjs';++const require = createRequire(import.meta.url);+const SCRIPT_DIR = path.dirname(fileURLToPath(import.meta.url));+const REPO_ROOT = path.resolve(SCRIPT_DIR, '..');+const OUTPUT_FILE = path.join(+ REPO_ROOT,+ 'packages',+ 'core',+ 'src',+ 'utils',+ 'standaloneMonthCapitals.generated.ts',+);+const CLDR_MISC_ROOT = path.dirname(+ require.resolve('cldr-misc-full/package.json'),+);+const CLDR_MISC_PACKAGE = JSON.parse(+ fs.readFileSync(path.join(CLDR_MISC_ROOT, 'package.json'), 'utf8'),+);++/** Whether CLDR titlecases a stand-alone month name in `language`. */+export function hasStandaloneMonthCapital(language) {+ const file = path.join(+ CLDR_MISC_ROOT,+ 'main',+ language,+ 'contextTransforms.json',+ );+ if (!fs.existsSync(file)) {+ return false;+ }+ const transforms = JSON.parse(fs.readFileSync(file, 'utf8')).main?.[language]+ ?.contextTransforms;+ return (+ transforms?.['month-standalone-except-narrow']?.['stand-alone'] ===+ 'titlecase-firstword'+ );+}++/** The shipped languages that capitalize a stand-alone month name, sorted. */+export function generateMonthCapitalLanguages() {+ const languages = new Set(+ getShippedLocales().map(locale => new Intl.Locale(locale).language),+ );+ return [...languages].filter(hasStandaloneMonthCapital).sort();+}++export async function renderGeneratedFile() {+ const languages = generateMonthCapitalLanguages();+ const source = `// Copyright (c) Meta Platforms, Inc. and affiliates.\n\n/**\n * @generated by scripts/generate-cldr-month-capitals.mjs from Unicode CLDR ${CLDR_MISC_PACKAGE.version}.\n * Do not edit by hand. Run \`pnpm generate:cldr-month-capitals\` instead.\n */\n\n/** Shipped languages whose stand-alone month names start with a capital. */\nexport const standaloneMonthCapitalLanguages: ReadonlySet<string> = new Set(${JSON.stringify(languages)});\n`;+ const prettierConfig = await resolveConfig(OUTPUT_FILE);+ return format(source, {...prettierConfig, filepath: OUTPUT_FILE});+}++async function main() {+ const check = process.argv.slice(2).includes('--check');+ const expected = await renderGeneratedFile();+ if (check) {+ const actual = fs.existsSync(OUTPUT_FILE)+ ? fs.readFileSync(OUTPUT_FILE, 'utf8')+ : '';+ if (actual !== expected) {+ console.error(+ '✗ Calendar CLDR month capitalization data is stale. Run `pnpm generate:cldr-month-capitals` and commit the result.',+ );+ process.exitCode = 1;+ return;+ }+ console.log('✓ Calendar CLDR month capitalization data is current');+ return;+ }+ fs.writeFileSync(OUTPUT_FILE, expected);+ console.log(`Generated ${path.relative(REPO_ROOT, OUTPUT_FILE)}`);+}++if (+ process.argv[1] &&+ import.meta.url === pathToFileURL(process.argv[1]).href+) {+ await main();+}diff --git a/scripts/generate-cldr-month-capitals.test.mjs b/scripts/generate-cldr-month-capitals.test.mjsnew file mode 100644index 0000000000..f70643259c--- /dev/null+++ b/scripts/generate-cldr-month-capitals.test.mjs@@ -0,0 +1,43 @@+// Copyright (c) Meta Platforms, Inc. and affiliates.++import fs from 'node:fs';+import path from 'node:path';+import {fileURLToPath} from 'node:url';+import {describe, expect, it} from 'vitest';+import {+ generateMonthCapitalLanguages,+ hasStandaloneMonthCapital,+ renderGeneratedFile,+} from './generate-cldr-month-capitals.mjs';++const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');+const OUTPUT_FILE = path.join(+ ROOT,+ 'packages/core/src/utils/standaloneMonthCapitals.generated.ts',+);++describe('generate-cldr-month-capitals', () => {+ it('matches the checked-in generated output', async () => {+ expect(await renderGeneratedFile()).toBe(+ fs.readFileSync(OUTPUT_FILE, 'utf8'),+ );+ });++ it("reads CLDR's stand-alone month transform", () => {+ expect(hasStandaloneMonthCapital('es')).toBe(true);+ expect(hasStandaloneMonthCapital('ru')).toBe(true);+ // CLDR records no transform for Vietnamese; German months are capitalized+ // in running text already.+ expect(hasStandaloneMonthCapital('vi')).toBe(false);+ expect(hasStandaloneMonthCapital('de')).toBe(false);+ // Czech titlecases months only in menus, not stand-alone.+ expect(hasStandaloneMonthCapital('cs')).toBe(false);+ });++ it('lists only shipped languages, sorted', () => {+ const languages = generateMonthCapitalLanguages();+ expect(languages).toEqual([...languages].sort());+ expect(languages).toContain('pl');+ expect(languages).not.toContain('vi');+ });+});