Skip to content

feat(lab): Schedule writes dates in the provider's calendar - #9994

Merged
nynexman4464 merged 3 commits into
mainfrom
nynexman4464/feat/calendar-schedule
Nov 5, 2026
Merged

nynexman4464 merged 3 commits into
mainfrom
nynexman4464/feat/calendar-schedule

Conversation

@nynexman4464

@nynexman4464 nynexman4464 commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Base is main (#9639 is merged).

This implements the Schedule part of spec:AST-111 (approved in #9605) FR18.

User need

An application that sets calendar="persian" (or hebrew, buddhist, …) on InternationalizationProvider gets Persian dates in Calendar, Timestamp and PowerSearch (since #9639). A Lab Schedule beside them still titles its months and labels its days in Gregorian, so one screen names the same day in two calendars.

Problem and solution fit

  • Labels follow the provider's calendar: the view title, day numbers, weekday and full-date labels, week ranges, and the dates of a long timed event. Each label names the month and day that Calendar shows for the same day, also where Intl and Temporal disagree on a month start in the Chinese or Dangi calendar.
  • Month titles: a Gregorian month that spans two calendar months is titled with both, such as "Mehr - Aban 1405 AP". A calendar month is named by its middle day through Core's calendarMonthLabelDay, the helper Calendar's month heading uses, so an era that starts inside the month does not rename it and the two cannot drift.
  • Layout stays Gregorian: the grids, paging, and every value Schedule takes or reports stay Gregorian.
  • Lab reaches Core through a new reserved internal entry, @astryxdesign/core/internal/calendar-system. It re-exports useCalendarSystem and the calendar helpers calendarMonthOf, formatCalendarDate and formatCalendarDateToParts, plus two that this pull request adds to Core: formatCalendarInstantRange for ranges, and calendarMonthLabelDay, the day that names a calendar month, which formatCalendarMonthLabel now uses too. Schedule resolves the calendar through that hook, with the same rules and the same no-Temporal fallback as Calendar.

Current specification

  • spec:AST-111 FR18 (draft): Schedule date labels render in the provider's calendar. FR2 (component prop, then provider prop, then gregory; a locale never selects the calendar) and FR5 (the no-Temporal fallback) apply unchanged.
  • spec:AST-017 FR21: Core's ./internal/* subpaths are reserved for Astryx's own packages and are outside the public API.
  • architecture:internationalization INV8–INV10.

Public delta and caller burden

  • No new prop. Without a provider calendar, every visible label is Gregorian, as before. One accessible label changes: the dates of a long timed event in its accessible name and in the time grid's accessible cell labels used to follow the locale's default calendar, so under fa-IR or th-TH they read in the Persian or Buddhist calendar. They now follow the provider's calendar like every other label, so without a provider calendar they read Gregorian (spec:AST-111 FR2: a locale never selects the calendar). The changeset discloses this.
  • No public API. The internal entry is undocumented and versioned with Core; a Changeset records it as [chore]. Lab adds temporal-polyfill as a dev dependency for its tests.
  • Caller burden: none beyond the provider's calendar. A calendar that needs Temporal needs a polyfill where the runtime lacks it, as for Calendar.
<InternationalizationProvider locale="en" calendar="persian">
  <Schedule view={monthView} defaultDate="2026-10-30" events={events} />
</InternationalizationProvider>
// before: "October 2026"
// after:  "Mehr - Aban 1405 AP"

Design and alternatives

Schedule reads the calendar that Core's date components resolve, so a Schedule and a Calendar in one subtree show the same calendar and fall back together. Ranges format each end through the same labels as Calendar; where Intl and Temporal name different days at either end, the range writes both ends in full.

Rejected: laying out and paging calendar months. Schedule's grids and values stay Gregorian; only its labels follow the calendar.

Evidence

  • Schedule.calendarSystems.test.tsx (40 cases): full-date, month-title, day-number, week-range, and long-event labels in persian, hebrew, and buddhist, each under English and its native locale; a month title across two calendar months, and across the 1989 japanese era change; the Gregorian month view under fa-IR without a provider calendar; iso8601 titles and ranges written as Gregorian ones; the day view label; a long timed event's accessible label under fa-IR without a provider calendar, which writes Gregorian dates and not Persian ones; and, without Temporal, Gregorian labels for persian with the development warning asserted, and buddhist still working.
  • calendarSystem.test.ts: a range whose ends differ between Intl and Temporal in the Chinese calendar is written in full at both ends; an iso8601 range reads as a Gregorian one.
  • internal/calendar-system.test.ts: the entry exports exactly the named helpers, including calendarMonthLabelDay, and the public i18n barrel does not export the hook.
  • Evidence gap: no Storybook story or real-browser run of Schedule under a provider calendar.

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

  • pnpm exec vitest run --maxWorkers=2 over the test files this pull request changes and the tests beside its changed sources (Core internal, i18n and utils, and Lab Schedule) plus docPropLiterals.test.ts: 65 files, 1,091 of 1,092 tests pass on the previous head. 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).
  • The last commit removes the zone parameter that Schedule's date-label helpers no longer read (it changes only Lab Schedule); the Lab Schedule tests pass on it: 6 files, 125 tests.
  • tsc --noEmit is clean for core, lab, and charts (lab and charts after a fresh core build).
  • pnpm check:knowledge and pnpm check:changesets pass.
  • node scripts/pre-review.mjs --base main: 805 authored lines.

Writing rubric results

This pull request changes no knowledge record. It changes consumer docs only (Schedule.doc.mjs and the InternationalizationProvider docs and prop comment) and the changeset.

  • R1 narration: none; no record changed.
  • R2 research: none.
  • R3 evidence: none; no record changed.
  • R4 rejected alternatives: none in a record.
  • R5 change references: none.
  • R6 open questions: none.

@vercel

vercel Bot commented Nov 4, 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 5, 2026 1:02am UTC

Request Review

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

astracat-bot Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 5, 2026, 2:32 AM UTC

@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: Schedule's calendar labels rely on the draft spec:AST-111 FR18, which is not current on main, where architecture:internationalization INV10 keeps built-in date displays Gregorian and leaves non-Gregorian component behavior to an owner decision. An engineering owner (the author may, as one) records approval by commenting /approve-spec followed by the full head commit SHA, or says this waits until AST-111 is current; the decision should also cover the two-month title ("Mehr - Aban 1405 AP"), naming a month by its middle day, and the bare "1" that starts a calendar month mid-row in the month view.

Needed whatever the decision:

  • monthLabelDate in packages/lab/src/Schedule/shared.tsx copies the middle-day rule from Core's formatCalendarMonthLabel: move that choice into one exported Core helper, call it from both places, and delete the copy so Schedule's titles cannot drift from Calendar's heading.
  • The description says Schedule "renders exactly as before" without a provider calendar, but under fa-IR a long timed event's accessible dates now change from Persian to Gregorian (correct under INV10): please say so, and add a test that pins it.

Smaller points: assert the development warning in the no-Temporal test, and drop formatWithPlainDate's unused _timezoneID parameter.

[Automated review]

Comment thread packages/lab/src/Schedule/shared.tsx Outdated
// that starts inside the month does not rename it.
function monthLabelDate(date: PlainDate, calendar: CalendarSystem): PlainDate {
const month = calendarMonthOf(calendar, date);
return plainDateAddDays(month.start, Math.floor(month.length / 2));

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 repeats the middle-day rule that Core's formatCalendarMonthLabel owns (packages/core/src/utils/calendarSystem.ts, plainDateAddDays(month.start, Math.floor(month.length / 2))). Could the date choice move into one exported helper in calendarSystem.ts, used by formatCalendarMonthLabel and re-exported from internal/calendar-system? Then Schedule's titles cannot drift from Calendar's heading.

minute: '2-digit',
timeZone: timezoneID,
}).formatRange(new Date(event.start), new Date(event.end));
return formatCalendarInstantRange(

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.

Without a provider calendar, this now pins Gregorian where the base used the locale's default calendar. Under fa-IR a long event's accessible dates change from "۴ آبان … تا ۶ آبان …" to "۲۶ اکتبر … تا ۲۸ اکتبر …". That is right under INV10, but the description says nothing changes without a provider calendar. Please note it there and pin it with a test, for example formatEventDateTimeRange(event, 'UTC', 'fa-IR', 'gregory').

@nynexman4464
nynexman4464 force-pushed the nynexman4464/feat/calendar-formatters branch from 3a9bb8b to bab4d52 Compare November 4, 2026 19:47
@nynexman4464
nynexman4464 force-pushed the nynexman4464/feat/calendar-schedule branch from 656f8a5 to dd1caaa Compare November 4, 2026 19:47

@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: Schedule's calendar labels rely on the draft spec:AST-111 FR18, which is not current on main, where architecture:internationalization INV10 keeps built-in date displays Gregorian and leaves non-Gregorian component behavior to an owner decision. An engineering owner (the author may, as one) records approval by commenting /approve-spec followed by the full head commit SHA, or says this waits until AST-111 is current; the decision should also cover the two-month title ("Mehr - Aban 1405 AP"), naming a month by its middle day, and the bare "1" that starts a calendar month mid-row in the month view.

Needed whatever the decision:

  • monthLabelDate in packages/lab/src/Schedule/shared.tsx copies the middle-day rule from Core's formatCalendarMonthLabel: move that choice into one exported Core helper, call it from both places, and delete the copy so Schedule's titles cannot drift from Calendar's heading.
  • The description says Schedule "renders exactly as before" without a provider calendar, but under fa-IR a long timed event's accessible dates now change from Persian to Gregorian (correct under INV10): please say so, and add a test that pins it.

Smaller points: assert the development warning in the no-Temporal test, and drop formatWithPlainDate's unused _timezoneID parameter.

[Automated review]

@nynexman4464
nynexman4464 force-pushed the nynexman4464/feat/calendar-formatters branch from bab4d52 to 0192de4 Compare November 4, 2026 22:30
@nynexman4464
nynexman4464 force-pushed the nynexman4464/feat/calendar-schedule branch from dd1caaa to bc95697 Compare November 4, 2026 22:30
@nynexman4464

Copy link
Copy Markdown
Contributor Author

/approve-spec bc95697

@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. Schedule's calendar labels follow spec:AST-111 FR18, which is now on main but still a draft, while the current architecture:internationalization INV10 keeps built-in date formatters Gregorian and leaves non-Gregorian component behavior to an owner decision. An engineering owner (the author may, as one) records approval by commenting /approve-spec followed by the full head commit SHA, or says this waits until AST-111 and the matching INV10 update are current; the decision should also cover the two-month title ("Mehr - Aban 1405 AP"), naming a month by its middle day, and a calendar month that starts mid-row in the month view.

Optional cleanups:

  • The description's evidence-gaps line about the development warning and the fa-IR long-event dates is out of date: the new tests cover both.
  • isSameCalendarYear, formatMonthTitle, formatFullDate, formatWeekday and formatDayNumber in shared.tsx keep a timezoneID parameter they no longer read.

[Automated review]

@nynexman4464
nynexman4464 force-pushed the nynexman4464/feat/calendar-formatters branch from 0192de4 to 6ebed8d Compare November 4, 2026 22:54
@nynexman4464
nynexman4464 force-pushed the nynexman4464/feat/calendar-schedule branch from bc95697 to 74d61b9 Compare November 4, 2026 22:54
@nynexman4464
nynexman4464 force-pushed the nynexman4464/feat/calendar-formatters branch from 6ebed8d to 396e07d Compare November 4, 2026 23:15
@nynexman4464
nynexman4464 force-pushed the nynexman4464/feat/calendar-schedule branch from 74d61b9 to 44d85a0 Compare November 4, 2026 23:15

@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. Schedule's calendar labels follow spec:AST-111 FR18, which is on main but still a draft; the current architecture:internationalization INV10 and component:InternationalizationProvider FR10 name only Calendar as following the provider's calendar, and component:Schedule has no calendar clause. The earlier /approve-spec names a previous head; this head carries the same patch on the moved base branch, so it needs its own approval. An engineering owner (the author may, as one) records the decision by commenting /approve-spec followed by the full head commit SHA, or says this waits until AST-111 FR18 and the matching INV10 and provider FR10 wording are current; the decision should also cover the two-month title ("Mehr - Aban 1405 AP"), naming a month by its middle day, and a calendar month that starts mid-row in the month view.

Optional cleanup:

  • isSameCalendarYear, formatMonthTitle, formatFullDate, formatWeekday and formatDayNumber in shared.tsx keep a timezoneID parameter they no longer read.

[Automated review]

@nynexman4464
nynexman4464 force-pushed the nynexman4464/feat/calendar-schedule branch from 44d85a0 to e927b65 Compare November 5, 2026 00:25
@nynexman4464

Copy link
Copy Markdown
Contributor Author

/approve-spec e927b65

@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: CI has not run on this head yet, because its test workflow runs only once this pull request targets main (after #9639 lands).

Schedule's date labels follow the provider's calendar as an engineering owner approved for this head, and the tests and real-browser checks bear it out; without a provider calendar the only change is the documented Gregorian dates in a long event's accessible name. There are no blocking findings.

  • When you retarget to main, Core's package.json exports and scripts/sync-exports.js will conflict with the entries main added beside yours.

[Automated review]

@nynexman4464
nynexman4464 changed the base branch from nynexman4464/feat/calendar-formatters to main November 5, 2026 00:52
Schedule's titles, day numbers, weekday and full-date labels, week ranges,
and long event ranges use the calendar that Core's date components
resolve. A Gregorian month that spans two calendar months is titled with
both. Schedule still lays out and steps Gregorian days, weeks, and months.

Lab reaches Core's calendar resolution and labels through the internal
@astryxdesign/core/internal/calendar-system entry, which adds
formatCalendarInstantRange for ranges. The provider docs name Schedule
among the components that follow the calendar.
…elDay

Core's formatCalendarMonthLabel and Schedule now share one rule for the day that names a calendar month. Schedule's long timed events get a test that their accessible dates stay Gregorian under fa-IR without a provider calendar, and the changeset says so. formatWithPlainDate drops its unused time-zone parameter.
A date label formats a PlainDate in the calendar, so it never reads a zone.

@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. Schedule's date labels follow spec:AST-111 FR18, which is still a draft on main, and no current record directs that behaviour or the title that names both calendar months a Gregorian month spans ("Mehr - Aban 1405 AP").

The earlier /approve-spec names the head before the rebase onto main, so it does not cover this head. An engineering owner records the decision by commenting /approve-spec <full head SHA> on this pull request, and the author may do so as an engineering owner; otherwise the change waits until FR18 is current on main.

There are no blocking findings, and without a provider calendar the only change is the disclosed Gregorian dates in a long event's accessible name.

[Automated review]

@nynexman4464

Copy link
Copy Markdown
Contributor Author

/approve-spec e39bf2b

@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · e39bf2b

Storybook · Sandbox · built from this PR's head

Modified components

Component Size LoC Visual · A11y · RTL
PowerSearch 249.5 kB (+12 B) · 22.3 kB CSS (0) — — · — · —
DateTimeInput 177.0 kB (+9 B) · 17.2 kB CSS (0) — — · — · —
Calendar 57.3 kB (+6 B) · 9.3 kB CSS (0) — — · — · —
6 more components
Component Size LoC Visual · A11y · RTL
DateRangeInput 75.6 kB (+6 B) · 11.2 kB CSS (0) — — · — · —
lab/Schedule · Storybook 63.5 kB (+4 B) · 3.9 kB CSS (0) 4,802 (+52) — · ✓ · ✓
Timestamp 22.9 kB (+1 B) · 8.9 kB CSS (0) — — · — · —
DateInput 154.9 kB (0) · 15.5 kB CSS (0) — — · — · —
lab/Comments 271.3 kB (0) · 2.5 kB CSS (0) — — · — · —
lab/CommentThread 266.2 kB (0) · 2.4 kB CSS (0) — — · — · —

Package size: measured; main has no measurement of the merge base to compare yet.

API changes: cli +8 · ~1 · −0 (against the merge base's committed report)

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

9 API changes (advisory)
Package Where Signature Usage
+ cli ./api · Types · type SearchResultEntry deprecated?: ComponentDeprecation | undefined import type {SearchResultEntry} from '@astryxdesign/cli/api'; const x: SearchResultEntry = {deprecated: …}
+ cli ./authoring · Types · interface ComponentDeprecation interface ComponentDeprecation import type {ComponentDeprecation} from '@astryxdesign/cli/authoring'
+ cli ./authoring · Types · interface MultiComponentDoc deprecated?: ComponentDeprecation import type {MultiComponentDoc} from '@astryxdesign/cli/authoring'; const x: MultiComponentDoc = {deprecated: …}
+ cli ./authoring · Types · interface SingleComponentDoc deprecated?: ComponentDeprecation import type {SingleComponentDoc} from '@astryxdesign/cli/authoring'; const x: SingleComponentDoc = {deprecated: …}
+ cli ./doc · Types · interface ComponentBaseDoc deprecated?: ComponentDeprecation import type {ComponentBaseDoc} from '@astryxdesign/cli/doc'; const x: ComponentBaseDoc = {deprecated: …}
+ cli ./doc · Types · interface SubComponentDoc deprecated?: ComponentDeprecation import type {SubComponentDoc} from '@astryxdesign/cli/doc'; const x: SubComponentDoc = {deprecated: …}
+ cli ./doc · Also exported from an earlier entry point · ComponentDeprecation ComponentDeprecation (./authoring) import {ComponentDeprecation} from '@astryxdesign/cli/doc'
+ cli ./template · Also exported from an earlier entry point · ComponentDeprecation ComponentDeprecation (./authoring) import {ComponentDeprecation} from '@astryxdesign/cli/template'
~ cli ./api · Functions · function search function search: (query: string, options?: { cwd?: string | undefined; type?: "template" | "component" | "hook" | "theme" | "doc" | undefined; limit?: number | undefined }) => Promise<SearchResponse> → function search: (query: string, options?: { cwd?: string | undefined; type?: "template" | "component" | "doc" | "theme" | "hook" | undefined; limit?: number | undefined }) => Promise<SearchResponse> import {search} from '@astryxdesign/cli/api'; search(…)

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.

Approved. Schedule's date labels now follow the provider's calendar, and an engineering owner approved that behaviour (draft spec:AST-111 FR18) for this head with /approve-spec. CI has run on this head and passed.

There are no blocking findings: without a provider calendar every visible label stays Gregorian, and the one accessible-name change for long timed events under locales such as fa-IR is disclosed in the changeset.

[Automated review]

@nynexman4464
nynexman4464 merged commit 6e2e242 into main Nov 5, 2026
70 checks passed
@github-actions
github-actions Bot deleted the nynexman4464/feat/calendar-schedule branch November 5, 2026 06:03

This branch was successfully deployed

1 active deployment
Preview — e39bf2be Deployed Nov 5, 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