Skip to content

feat(i18n): InternationalizationProvider takes a calendar and exposes the resolved calendar - #9791

Merged
nynexman4464 merged 6 commits into
mainfrom
nynexman4464/feat/calendar-system-boundary
Nov 4, 2026
Merged

nynexman4464 merged 6 commits into
mainfrom
nynexman4464/feat/calendar-system-boundary

Conversation

@nynexman4464

@nynexman4464 nynexman4464 commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Base is main. First PR of the calendar-systems stack. #9622 (Calendar) stacks on this branch.

This implements the provider and shared-utility part of spec:AST-111 (approved in #9605): FR1 and FR2 for InternationalizationProvider, the FR5 fallback that date components use, and the calendar-system utility that later PRs read.

User need

Applications that serve people who use another calendar need one place to say which calendar their dates are in, separately from language. A locale alone can't say it: fa-IR users don't all want the Persian calendar, and a Thai app may want Buddhist years while its locale stays en. Without a provider-level calendar, every date component would need its own prop and its own resolution rules.

Problem and solution fit

  • Provider calendar: InternationalizationProvider takes calendar?: CalendarSystem. Without it, the calendar is Gregorian. A locale never selects one, even with a -u-ca- keyword: honoring the keyword would change released output with no code change, so it waits for a later minor release.
  • Context: the provider exposes its calendar on InternationalizationContext as calendar.
  • Resolution: an unknown identifier resolves to gregory and warns once in development. calendar="islamic" is not a supported identifier, so it resolves to gregory with that warning.
  • Fallback for date components (i18n/useCalendarSystem.ts, internal): a component resolves its own calendar prop, then the provider's, then gregory. Where Temporal is missing, a calendar outside the Gregorian-aligned set resolves to gregory with one development warning per calendar. The context keeps the requested calendar.
  • Shared utility (utils/calendarSystem.ts): calendar months located by their Gregorian days, month and year steps, dates from calendar fields, months in a year, availability of each calendar, labels and locale digits. Temporal does the arithmetic for every calendar whose months are not Gregorian; Gregorian-aligned calendars never touch it.
  • No component changes yet. Astryx date components still show Gregorian dates. Calendar adopts the provider calendar in feat(Calendar): show the months of the selected calendar system #9622; the inputs follow later in the stack.
  • Supporting changes:
    • resolution tests;
    • utility tests against temporal-polyfill (a dev dependency, imported only by tests);
    • the provider doc and records;
    • the API report and a changeset;
    • in plainDate.ts: a calendar parameter on plainDateFormatStandaloneMonthYear (default gregory), an internal plainDateFormatToParts from the same formatter as plainDateFormat, with a required locale, and an optional numberingSystem on plainDateFormatDayNumber, which the utility uses to write day numbers.

Current specification

  • spec:AST-111 FR1, FR2 and FR5 (approved in spec(AST-111): date components use the calendar the application chooses #9605).
  • architecture:internationalization INV10 states that the application selects the calendar, that values stay Gregorian ISO, and the Temporal boundary. It also states that Astryx date components show Gregorian dates.
  • component:InternationalizationProvider adds the calendar concept, FR10, ORD3 and the FR10 verification row, adds calendar to FR8's nested-provider rule, and links spec:AST-111 FR1 and FR2.

AST-111 is still a draft, so this PR waits for its approval.

Public delta and caller burden

  • New type: CalendarSystem, exported from @astryxdesign/core/i18n: gregory, iso8601, buddhist, roc, japanese, persian, indian, hebrew, chinese, dangi, coptic, ethiopic, ethioaa, islamic-civil, islamic-tbla, islamic-umalqura.
  • New prop and field: InternationalizationProvider calendar?: CalendarSystem; InternationalizationContextValue calendar?: CalendarSystem.
  • Default unchanged: without a calendar, everything resolves to Gregorian. No rendered output changes in this PR.
<InternationalizationProvider locale="fa-IR" calendar="persian">
  {children} {/* context.calendar === 'persian'; components still show Gregorian dates */}
</InternationalizationProvider>

Design and alternatives

  • Astryx reads a small structural subset of Temporal from globalThis, so published types don't need the esnext.temporal library and Gregorian applications load nothing.
  • Resolution runs during render, so a server and a browser with the same Temporal availability resolve the same calendar.
  • Rejected by the spec: following the locale's default calendar, values tagged with their calendar, and a bundled polyfill.

Evidence

  • Resolution order (component prop over provider prop over default; a -u-ca- locale stays Gregorian, also under a provider calendar), every identifier, an unknown identifier and islamic, bare fa-IR and th-TH, a calendar independent of language, and the no-Temporal fallback with its once-per-calendar warning, including a Temporal that lacks the calendar.
  • Month structure at fixed dates (Persian Aban 1405, the Hebrew 5784 leap year, Ethiopic Pagume, the 2019 Japanese era change, the Chinese calendar's 2023 leap month), and invariants for every Temporal calendar from 1900 through 2100.
  • calendarDateFromFields rejects dates a calendar does not have (30 Esfand in a common year) instead of adjusting them.
  • plainDateFormatToParts joins to the plainDateFormat text, and plainDateFormatDayNumber writes a given numbering system's digits.

Scope

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

Testing

  • Vitest, --maxWorkers=2, over the test files beside the changed sources (utils and i18n) plus docPropLiterals: 55 files, 951 of 952 tests passed. The one failure, hitArea.test.ts "batches every pending control into one frame: all reads, then all writes", fails the same way on the main commit the stack sits on (d23d1fe438).
  • pnpm exec tsc --noEmit -p packages/core: passes.
  • pnpm check:knowledge, pnpm check:changesets: pass.
  • node scripts/pre-review.mjs --base main: 1,337 authored lines.

Writing rubric results

architecture:internationalization

  • R1 narration: none. INV10 states the resolution order, the Gregorian ISO values, the Temporal boundary and the Gregorian components in the present tense.
  • R2 research: none.
  • R3 evidence: the INV10 verification row names the two calendar-system test files. No change references.
  • R4 rejected alternatives: none added.
  • R5 change references: none added.
  • R6 open questions: none added.

component:InternationalizationProvider

  • R1 narration: none. The calendar concept, FR10 and ORD3 are present tense and claim only resolution and the context field. The Owns line names only calendar as the calendar's source, as FR10 and ORD3 do.
  • R2 research: none.
  • R3 evidence: the FR10 row names the resolution test and its cases.
  • R4 rejected alternatives: none added.
  • R5 change references: none.
  • R6 open questions: none added.

@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 10:37pm 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
🟢 Reviewed (for maintainers only) Nov 4, 2026, 10:48 PM UTC

@github-actions

github-actions Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · 8f6918e

Storybook · Sandbox · built from this PR's head

Modified components

Component Size LoC
Calendar 54.6 kB (+61 B) · 9.3 kB CSS (0) —
DateRangeInput 71.4 kB (+54 B) · 11.2 kB CSS (0) —
PowerSearch 245.1 kB (+50 B) · 22.2 kB CSS (0) —
117 more components
Component Size LoC
DateInput 152.0 kB (+47 B) · 15.5 kB CSS (0) —
DateTimeInput 174.2 kB (+46 B) · 17.2 kB CSS (0) —
charts/Chart 160.4 kB (0) · 494 B CSS (0) —
charts/ChartLegend 34.4 kB (0) · 224 B CSS (0) —
AlertDialog 86.8 kB (0) · 13.1 kB CSS (0) —
AppShell 73.3 kB (0) · 12.2 kB CSS (0) —
Avatar 34.8 kB (0) · 5.4 kB CSS (0) —
AvatarGroup 37.5 kB (0) · 5.5 kB CSS (0) —
AvatarGroupOverflow 38.9 kB (0) · 5.5 kB CSS (0) —
Banner 47.3 kB (0) · 9.2 kB CSS (0) —
BaseTypeahead 55.4 kB (0) · 9.7 kB CSS (0) —
BreadcrumbItem 69.5 kB (0) · 11.3 kB CSS (0) —
Breadcrumbs 16.0 kB (0) · 3.4 kB CSS (0) —
Button 45.3 kB (0) · 8.7 kB CSS (0) —
Carousel 49.7 kB (0) · 9.5 kB CSS (0) —
ChatComposer 61.6 kB (0) · 10.6 kB CSS (0) —
ChatComposerDrawer 17.5 kB (0) · 4.7 kB CSS (0) —
ChatComposerInput 59.5 kB (0) · 10.0 kB CSS (0) —
ChatComposerTokenElement 59.5 kB (0) · 10.0 kB CSS (0) —
ChatDictationButton 45.9 kB (0) · 8.8 kB CSS (0) —
ChatLayout 48.5 kB (0) · 9.3 kB CSS (0) —
ChatLayoutScrollButton 45.8 kB (0) · 8.9 kB CSS (0) —
ChatMessage 16.7 kB (0) · 3.7 kB CSS (0) —
ChatMessageList 22.8 kB (0) · 6.9 kB CSS (0) —
ChatMessageMetadata 19.8 kB (0) · 4.1 kB CSS (0) —
ChatSendButton 45.8 kB (0) · 8.7 kB CSS (0) —
ChatToolCalls 25.9 kB (0) · 8.2 kB CSS (0) —
CheckboxInput 48.8 kB (0) · 8.7 kB CSS (0) —
CheckboxList 44.6 kB (0) · 7.5 kB CSS (0) —
CheckboxListItem 54.2 kB (0) · 10.4 kB CSS (0) —
Citation 20.1 kB (0) · 4.5 kB CSS (0) —
CodeBlock 59.2 kB (0) · 10.0 kB CSS (0) —
CommandPalette 53.5 kB (0) · 12.3 kB CSS (0) —
CommandPaletteFooter 17.0 kB (0) · 3.7 kB CSS (0) —
CommandPaletteInput 26.9 kB (0) · 7.4 kB CSS (0) —
CommandPaletteList 16.0 kB (0) · 3.4 kB CSS (0) —
ComplexSelector 55.8 kB (0) · 10.5 kB CSS (0) —
ContextMenu 75.5 kB (0) · 15.9 kB CSS (0) —
DialogHeader 48.2 kB (0) · 10.2 kB CSS (0) —
DrawerHeader 48.4 kB (0) · 11.6 kB CSS (0) —
DropdownMenu 74.2 kB (0) · 16.0 kB CSS (0) —
DropdownMenuSubMenu 58.0 kB (0) · 9.3 kB CSS (0) —
Field 42.0 kB (0) · 6.9 kB CSS (0) —
FieldLabel 38.0 kB (0) · 5.4 kB CSS (0) —
FileInput 53.9 kB (0) · 9.7 kB CSS (0) —
IconButton 45.4 kB (0) · 8.7 kB CSS (0) —
InfoTip 37.5 kB (0) · 5.0 kB CSS (0) —
InputGroup 43.1 kB (0) · 7.3 kB CSS (0) —
Kbd 16.7 kB (0) · 3.6 kB CSS (0) —
LayerProvider 63.4 kB (0) · 9.4 kB CSS (0) —
Lightbox 52.6 kB (0) · 9.1 kB CSS (0) —
Link 42.8 kB (0) · 6.9 kB CSS (0) —
ListItem 53.5 kB (0) · 10.4 kB CSS (0) —
Markdown 146.2 kB (0) · 18.8 kB CSS (0) —
MetadataList 16.7 kB (0) · 3.8 kB CSS (0) —
MobileNav 54.4 kB (0) · 9.3 kB CSS (0) —
MobileNavToggle 45.7 kB (0) · 8.7 kB CSS (0) —
MoreMenu 74.4 kB (0) · 16.0 kB CSS (0) —
MultiSelector 73.2 kB (0) · 15.3 kB CSS (0) —
NumberInput 55.2 kB (0) · 10.2 kB CSS (0) —
Outline 22.2 kB (0) · 4.2 kB CSS (0) —
Pagination 88.1 kB (0) · 16.5 kB CSS (0) —
Popover 52.1 kB (0) · 12.8 kB CSS (0) —
RadioList 43.5 kB (0) · 6.9 kB CSS (0) —
RadioListItem 52.0 kB (0) · 9.4 kB CSS (0) —
ResizeHandle 19.5 kB (0) · 4.3 kB CSS (0) —
SegmentedControl 82.9 kB (0) · 6.7 kB CSS (0) —
Selector 79.3 kB (0) · 16.2 kB CSS (0) —
SideNav 73.7 kB (0) · 10.1 kB CSS (0) —
SideNavCollapseButton 46.2 kB (0) · 8.8 kB CSS (0) —
SideNavHeading 59.9 kB (0) · 10.0 kB CSS (0) —
SideNavItem 54.9 kB (0) · 9.8 kB CSS (0) —
Slider 91.1 kB (0) · 8.3 kB CSS (0) —
Spinner 18.5 kB (0) · 5.7 kB CSS (0) —
Step 28.3 kB (0) · 5.6 kB CSS (0) —
Stepper 46.9 kB (0) · 8.9 kB CSS (0) —
Switch 88.6 kB (0) · 9.5 kB CSS (0) —
Table 84.9 kB (0) · 16.6 kB CSS (0) —
TableCell 76.7 kB (0) · 16.3 kB CSS (0) —
TableHeaderCell 76.3 kB (0) · 16.1 kB CSS (0) —
TableSelectionToolbar 54.9 kB (0) · 11.8 kB CSS (0) —
TabList 35.5 kB (0) · 6.4 kB CSS (0) —
TabMenu 56.6 kB (0) · 9.9 kB CSS (0) —
TextArea 48.2 kB (0) · 8.8 kB CSS (0) —
TextInput 53.1 kB (0) · 9.9 kB CSS (0) —
Thumbnail 49.7 kB (0) · 10.3 kB CSS (0) —
TimeInput 138.2 kB (0) · 14.5 kB CSS (0) —
Toast 59.7 kB (0) · 9.0 kB CSS (0) —
ToggleButton 46.2 kB (0) · 8.8 kB CSS (0) —
Token 25.8 kB (0) · 4.8 kB CSS (0) —
Tokenizer 70.1 kB (0) · 17.1 kB CSS (0) —
Toolbar 34.8 kB (0) · 7.9 kB CSS (0) —
TopNav 56.0 kB (0) · 9.6 kB CSS (0) —
TopNavHeading 59.3 kB (0) · 9.8 kB CSS (0) —
TopNavMegaMenu 54.4 kB (0) · 10.6 kB CSS (0) —
TopNavMenu 59.2 kB (0) · 9.9 kB CSS (0) —
TreeList 39.6 kB (0) · 5.3 kB CSS (0) —
Typeahead 63.3 kB (0) · 11.2 kB CSS (0) —
lab/ChatEmojiPicker 66.0 kB (0) · 773 B CSS (0) —
lab/ChatReactionBar 66.5 kB (0) · 1.1 kB CSS (0) —
lab/ChatTypingIndicator 24.8 kB (0) · 612 B CSS (0) —
lab/CommentComposer 104.9 kB (0) · 1.9 kB CSS (0) —
lab/CommentPin 47.1 kB (0) · 1.2 kB CSS (0) —
lab/Comments 265.4 kB (0) · 2.5 kB CSS (0) —
lab/CommentThread 260.1 kB (0) · 2.4 kB CSS (0) —
lab/DiffViewer 71.4 kB (0) · 2.1 kB CSS (0) —
lab/EmojiPicker 70.8 kB (0) · 722 B CSS (0) —
lab/ListInput 82.0 kB (0) · 1.6 kB CSS (0) —
lab/SelectableCardGroup 50.5 kB (0) · 162 B CSS (0) —
lab/TourStep 58.0 kB (0) · 590 B CSS (0) —
lab/TransferList 75.9 kB (0) · 1.7 kB CSS (0) —
lab/TransferListSelector 83.5 kB (0) · 1.9 kB CSS (0) —
richtext/RichTextEditor 278.4 kB (0) · 2.6 kB CSS (0) —
richtext/RichTextEditorToolbar 228.8 kB (0) · 454 B CSS (0) —
richtext/RichTextView 258.9 kB (0) · 2.3 kB CSS (0) —
Timestamp 21.3 kB (−5 B) · 8.9 kB CSS (0) —
lab/Schedule 60.7 kB (−5 B) · 3.9 kB CSS (0) —

Package size: @astryxdesign/core 6.44 MB packed (+10.9 kB); no new dependencies.

API changes: core +4 · ~0 · −0

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

4 API changes (advisory)
Package Where Signature Usage
+ core . · Components · component InternationalizationProvider prop calendar?: CalendarSystem <InternationalizationProvider calendar={…} />
+ core . · Types · type CalendarSystem type CalendarSystem = 'gregory' | 'iso8601' | 'buddhist' | 'roc' | 'japanese' | 'persian' | 'indian' | 'hebrew' | 'chinese' | 'dangi' | 'coptic' | 'ethiopic' | 'ethioaa' | 'islamic-c … #85e5f84c import type {CalendarSystem} from '@astryxdesign/core'
+ core . · Types · interface InternationalizationContextValue calendar?: CalendarSystem import type {InternationalizationContextValue} from '@astryxdesign/core'; const x: InternationalizationContextValue = {calendar: …}
+ core ./i18n · Also exported from an earlier entry point · CalendarSystem CalendarSystem (.) import {CalendarSystem} from '@astryxdesign/core/i18n'

Not run on this PR: add ci:run-visual, ci:run-a11y or ci:run-rtl to run them.


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 spec decision. The calendar prop on InternationalizationProvider, the calendar context field, the exported CalendarSystem type, and the rewrites of INV10 and of the provider record's FR8, FR10 and ORD3 all rest on spec:AST-111 FR1, FR2 and FR5, which are still a draft and are not on main. An engineering owner records the decision by commenting /approve-spec <full head SHA> on this pull request; the author may do so if they are an engineering owner.

Whatever that decision, two fixes are needed:

  • The changeset, the calendar prop JSDoc and the provider doc say calendars that need Temporal resolve to Gregorian and warn when it is missing, but the provider puts the requested calendar on the context unchanged and warns nothing, so reword them to say the fallback applies when a date component resolves the calendar.
  • utcMidnight and formatToParts in packages/core/src/utils/calendarSystem.ts copy the date-only path of plainDateFormat in plainDate.ts and already drop the timeZone and time-of-day options that plainDateFormat honours, so export one shared helper from plainDate.ts and call it instead.

[Automated review]

Comment thread .changeset/calendar-system-boundary.md Outdated
'@astryxdesign/core': patch
---

[feat] InternationalizationProvider takes a `calendar` prop (`CalendarSystem`, exported from `@astryxdesign/core/i18n`), such as `'persian'`, `'hebrew'`, `'islamic-umalqura'`, or `'buddhist'`, and exposes the resolved calendar on `InternationalizationContext` as `calendar`. A `-u-ca-` keyword in the provider locale, such as `th-TH-u-ca-buddhist`, selects one too; a locale alone never changes the calendar, so `fa-IR` resolves to Gregorian until you set `calendar="persian"`. An unknown identifier resolves to Gregorian and warns once in development. The Gregorian-aligned calendars (`gregory`, `iso8601`, `buddhist`, `roc`, `japanese`) work everywhere; the others need `Temporal`, and without it they resolve to Gregorian and warn once in development. Astryx date components keep showing Gregorian dates, and date values stay Gregorian ISO strings.

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 says calendars that need Temporal "resolve to Gregorian and warn once in development" when it is missing. The provider puts the requested calendar on the context unchanged and warns nothing; the PR's own the provider accepts %s test expects 'persian' with Temporal removed. Suggest saying that the context carries the requested calendar, and that the Gregorian fallback and its warning apply when a date component resolves it. The prop JSDoc and the provider doc entry need the same change.

Comment on lines +299 to +316
function utcMidnight(pd: PlainDate): number {
const date = new Date(0);
date.setUTCFullYear(pd.year, pd.month - 1, pd.day);
return date.getTime();
}

function formatToParts(
calendar: CalendarSystem,
pd: PlainDate,
options: Intl.DateTimeFormatOptions,
locale: Locale,
): Intl.DateTimeFormatPart[] {
return dateTimeFormatFor(locale, {
...options,
calendar,
timeZone: 'UTC',
}).formatToParts(utcMidnight(pd));
}

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.

These copy plainDate.ts's private utcTime and the date-only branch of plainDateFormat (dateTimeFormatFor(locale, {...options, calendar, timeZone: 'UTC'}) over UTC midnight), and they already differ: plainDateFormat honours timeZone and time-of-day options, while this always forces UTC. Exporting one parts-returning helper from plainDate.ts that shares plainDateFormat's branch selection, and calling it from formatCalendarDate, keeps one path.

Comment on lines +293 to +294
// Intl has no month names for `iso8601`. It drops the month or orders the
// fields oddly, so labels use `gregory`, which has the same months and days.

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: this sentence carries two topics and a vague word. Suggested:

// Intl has no month names for `iso8601`. Labels use `gregory`, which has the same months and days.

@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 spec decision. The calendar prop on InternationalizationProvider, the calendar context field, the exported CalendarSystem type, and the rewrites of INV10 and of the provider record's FR8, FR10 and ORD3 all rest on spec:AST-111 FR1, FR2 and FR5, which are still a draft and are not on main. An engineering owner records the decision by commenting /approve-spec <full head SHA> on this pull request; the author may do so if they are an engineering owner.

The Temporal-fallback wording and the copied date-only formatting path from the last review are fixed; one fix is still needed whatever the decision:

  • formatDayNumber and its cache in packages/core/src/utils/calendarSystem.ts (lines 380-401) copy plainDateFormatDayNumber in plainDate.ts, which Calendar's day cells already use, so give the shared helper an optional numberingSystem, call it from formatCalendarDate, and drop the raw-Intl lint allowlist, README and Owning code entries that exist only for the copy.

[Automated review]

Comment on lines +380 to +401
const dayNumberFormats = new Map<string, Intl.NumberFormat>();

/**
* A day of the month written in the locale's digits, such as ۸ in `fa`, or in
* the given numbering system.
*/
export function formatDayNumber(
day: number,
locale: Locale,
numberingSystem?: string,
): string {
const key = `${locale}|${numberingSystem ?? ''}`;
let format = dayNumberFormats.get(key);
if (format == null) {
format = new Intl.NumberFormat(locale, {
useGrouping: false,
numberingSystem,
});
dayNumberFormats.set(key, format);
}
return format.format(day);
}

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 copies plainDateFormatDayNumber in plainDate.ts (the same new Intl.NumberFormat(locale, {useGrouping: false}) behind a module-level cache), which Calendar's day cells and MonthScroller already call. Giving the shared helper an optional numberingSystem and calling it from formatCalendarDate keeps one path for day digits, and the raw-Intl allowlist, README and Owning code entries for this file are then no longer needed.

Comment on lines +92 to +93
// The subset of the Temporal API that this module reads. It is declared here
// so that the published types do not need the `esnext.temporal` library.

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: "It is declared here" is passive. Suggested:

// The published types must not need the `esnext.temporal` library.
// This module declares only the Temporal members it reads.

: undefined;
}

// Keyed by the Temporal object, so a polyfill loaded later is probed again.

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: passive wording. Suggested:

// The key is the Temporal object, so a polyfill that loads later gets its own probe.

… the resolved calendar

Add the calendar-system utility, the provider's calendar prop and its resolution, the context field, and the raw-Intl lint allowance for day digits. Astryx date components still show Gregorian dates.
… formatter path

The provider keeps the requested calendar on the context, and a date component that resolves it falls back to Gregorian where Temporal is missing; the changeset, the prop docs, and INV10 now say so. Calendar labels take their parts from plainDateFormatToParts, which shares plainDateFormat's formatter and date, instead of a copy of its date-only path.
…yNumber

plainDateFormatDayNumber takes an optional numbering system, and
formatCalendarDate calls it instead of its own NumberFormat cache.
calendarSystem.ts no longer calls Intl directly, so it leaves the
raw-Intl allowlist and the Owning code formatter list.
The provider resolves its calendar from its calendar prop, else gregory.
A locale such as th-TH-u-ca-buddhist shows Gregorian dates on the latest
release, so honoring the keyword would change output with no code change.
The keyword lookup and the islamic alias go; calendar="islamic" now
resolves to gregory with the unknown-identifier warning.

@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 spec decision. The calendar prop on InternationalizationProvider, the calendar context field, the exported CalendarSystem type and the rewrites of INV10 and of the provider record's FR8, FR10 and ORD3 rest on draft spec:AST-111 (#9605), which is not on main, and its latest FR2 no longer lets a -u-ca- keyword or the islamic alias select the calendar, as this head does. An engineering owner records the decision, including whether a -u-ca- keyword selects the calendar, by commenting /approve-spec <full head SHA> on this pull request; the author may do so if they are an engineering owner.

Whatever that decision, two fixes are needed:

  • Miss: plainDateFormatToParts in packages/core/src/utils/plainDate.ts (lines 473-477) is a new helper whose locale defaults to 'en', which INV9 rules out for new pure helpers, so make locale required, as both callers already pass it.
  • Miss: isInCalendarMonth in packages/core/src/utils/calendarSystem.ts (lines 268-276) rebuilds the inclusive range check that plainDateIsInRange in plainDate.ts already provides and Calendar's day cells use, so call the shared helper instead.

[Automated review]

Comment thread packages/core/src/utils/plainDate.ts Outdated
export function plainDateFormatToParts(
pd: PlainDate,
options: Intl.DateTimeFormatOptions,
locale: Locale = 'en',

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.

Miss: this new helper defaults locale to 'en'. INV9 says new pure helpers require an explicit locale, and the raw-Intl lint does not check this helper, so a caller that leaves it out shows English silently. Both callers already pass it:

  locale: Locale,

Comment on lines +273 to +275
return (
!plainDateIsBefore(pd, month.start) && !plainDateIsAfter(pd, month.end)
);

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.

Miss: this rebuilds the inclusive range check that plainDateIsInRange in plainDate.ts already provides, and Calendar's day cells call that helper. Calling it keeps one path:

  return plainDateIsInRange(pd, [month.start, month.end]);

@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 spec decision. The calendar prop on InternationalizationProvider, the calendar context field, the exported CalendarSystem type, the calendar utility and the rewrites of INV10 and the provider record's FR10 and ORD3 rest on the AST-111 calendar-systems spec, which is still a draft in #9605; this head now follows that draft, including that a -u-ca- keyword never selects the calendar. An engineering owner records the decision by commenting /approve-spec <full head SHA> on this pull request, and the author may do so if they are an engineering owner. These need a fix whatever the decision:

  • Miss: plainDateFormatToParts (packages/core/src/utils/plainDate.ts:476) defaults locale to 'en', but INV9 requires new pure helpers to take an explicit locale, so make the parameter required.
  • Miss: isInCalendarMonth (packages/core/src/utils/calendarSystem.ts:269-276) rebuilds the range check that plainDateIsInRange already provides, so return plainDateIsInRange(pd, [month.start, month.end]) instead.
  • Regression: the provider record's Owns line (docs/specs/components/i18n/InternationalizationProvider.spec.md:75) still says the calendar resolves from calendar and locale, which contradicts FR10 and ORD3 now that the keyword step is gone.

[Automated review]

Comment on lines +75 to +76
- Resolving the subtree's calendar system from `calendar` and `locale`, and
exposing it on the context.

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.

Regression: this still names locale as a calendar input, but FR10 and ORD3 below now say a locale never selects the calendar. Suggested:

- Resolving the subtree's calendar system from `calendar`, and
  exposing it on the context.

…inDateIsInRange

The provider record's ownership line no longer names the locale as a calendar input.
@nynexman4464

Copy link
Copy Markdown
Contributor Author

/approve-spec 8f6918e

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval 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.

Approved pending CI: one test shard was still running on this head, so wait for CI to pass before landing.

The calendar prop on InternationalizationProvider, the calendar context field and the CalendarSystem type follow the provider and internationalization records, which an engineering owner approved for this exact head. The latest commit fixes the three issues raised earlier: plainDateFormatToParts now requires its locale, isInCalendarMonth reuses plainDateIsInRange, and the provider record no longer names locale as a calendar input.

Two optional follow-ups:

  • FR8 now says a nested provider replaces calendar, but no test covers it; a parent calendar="persian" with a child provider that omits it, expecting 'gregory', would guard it.
  • The useCalendarSystem.ts header says date components read the hook, but none does yet.

[Automated review]

Comment on lines +10 to +11
* @position Internal i18n hook; read by InternationalizationProvider and date
* components. Not re-exported from the i18n barrel.

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: the provider imports only resolveCalendarSystem, and no date component imports this file yet. Suggested:

 * @position Internal i18n hook. The provider imports resolveCalendarSystem.
 *   Not re-exported from the i18n barrel.

| FR5 | The provider MUST NOT set DOM `lang` or `dir`. Its direction value and the application's DOM direction are separate inputs the application keeps aligned. | `architecture:internationalization/INV12` | settled |
| FR6 | Without a provider, the public context and hooks MUST expose locale `en`, direction `ltr`, an empty supplied-catalog map, and a translator backed by shipped English. | Released context and tests | settled |
| FR7 | The provider MUST preserve a string-returning translator suitable for visible and assistive attributes. | Released catalog/runtime contract | settled |
| FR8 | A nested provider MUST replace locale, messages, overrides, direction, and calendar with values derived solely from the child provider's own props rather than merge parent context. | Released provider and nested-provider tests | settled |

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: FR8 now covers calendar, but its verification row still names only messages, overrides and direction, and no test renders a nested provider with a calendar. A case with a parent calendar="persian" and a child provider that omits it, expecting 'gregory', would guard this.

@nynexman4464
nynexman4464 merged commit 4e7823a into main Nov 4, 2026
65 checks passed
@github-actions
github-actions Bot deleted the nynexman4464/feat/calendar-system-boundary branch November 5, 2026 06:03

This branch was successfully deployed

1 active deployment
Preview — 8f6918e7 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant