Skip to content

fix(DateInput, DateTimeInput): plain wording for a date the calendar does not have - #11309

Merged
nynexman4464 merged 3 commits into
mainfrom
nynexman4464/fix/date-error-wording
Nov 12, 2026
Merged

nynexman4464 merged 3 commits into
mainfrom
nynexman4464/fix/date-error-wording

Conversation

@nynexman4464

@nynexman4464 nynexman4464 commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

User impact

A typed date that the calendar does not have, such as 02/31/2026, showed "This date does not exist in the Gregorian Calendar". The message is technical, and it names the default calendar that nobody chose. It now reads "Enter a real date". The calendar is named only when the field's calendar differs from the app's calendar, in parentheses: "Enter a real date (Persian Calendar)". A day that dateConstraints rules out now reads "Enter an available date" instead of "This date is not available". The out-of-range messages ("Enter a date on or after …") do not change.

Problem and solution fit

  • Why change it? Plain language asks for what the person should do. GOV.UK's date input pattern uses "must be a real date" for exactly this case. No date input in the major libraries, browsers, or operating systems names the calendar in an error.
  • Why name the calendar sometimes? In a field whose calendar differs from the app's (a Persian field in a Gregorian app, or the reverse), the name tells the person which calendar the date must exist in. The rule is the same one that spec:AST-111 AR2 uses for the field's description, and useTypedDate already computes it.
  • Why parentheses? Intl.DisplayNames returns a standalone calendar name. In languages such as German, Russian, and Polish, that form does not fit inside a sentence after a preposition, so the name stands apart.

Expected behavior and authority

  • spec:AST-111 AR3: each rejection kind has its own message. This adds one sentence: the message for a date the calendar does not have names the calendar only when the field's calendar differs from its provider's calendar, as AR2 says for the description.
  • component:DateInput AR3 and component:DateTimeInput AR5 cite AST-111 AR3 and require a distinct catalog message per kind, which stays true.

Smallest restoration

  • packages/core/locales/en.json: @astryx.dateInput.nonexistentDate becomes {named, select, yes {Enter a real date ({calendar})} other {Enter a real date}}, and the other branch of @astryx.dateInput.outOfRangeDate becomes "Enter an available date". No locale catalog translates these keys yet, so no translation is lost.
  • useTypedDate.ts: passes named from the existing provider-calendar comparison.

Evidence

Case Before After
02/31/2026 in a Gregorian app This date does not exist in the Gregorian Calendar Enter a real date
12/30/1404 AP in a Persian field in a Gregorian app This date does not exist in the Persian Calendar Enter a real date (Persian Calendar)
12/30/1404 AP with calendar="persian" on the provider This date does not exist in the Persian Calendar Enter a real date
a Sunday under a no-weekends dateConstraints This date is not available Enter an available date
  • Regression tests: DateInput.calendar.test.tsx "leaves the calendar's name out when the field uses the provider's calendar" and "asks for an available date when a date constraint rules the day out", plus the updated expectations in the existing nonexistent-date tests in DateInput.calendar.test.tsx and DateTimeInput.calendar.test.tsx. The Gregorian and provider-calendar cases assert the exact text, so a calendar name appended by mistake fails them.

Scope

Components: DateInput, DateTimeInput

  • One defect is restored.
  • Separable contradictory or unsettled tagalongs were removed or split.
  • No new public API, visual representation, default, or interaction model is hidden under the bug-fix label.
  • Public text and artifacts contain no internal Meta context.

Writing rubric results

Record touched: spec:AST-111 (AR3).

  • R1 narration: none; the added sentence states what the message names.
  • R2 research: none; the library survey stays in this description.
  • R3 evidence naming a change: none.
  • R4 rejected alternatives: none added.
  • R5 pull request or issue references: none.
  • R6 open questions: none; Open questions stay "None".
  • R7 project status: none.

Testing

  • vitest run over packages/core/src/{DateInput,DateTimeInput,DateRangeInput,PowerSearch,i18n}, calendarDateParser.test.ts, and scripts/check-i18n-catalog.test.mjs: 56 files, 1,859 tests pass.
  • pnpm check:i18n-catalog and pnpm check:i18n-runtime: pass.
  • pnpm check:knowledge: passes. Changeset coverage: passes.
  • node scripts/pre-review.mjs --base origin/main: 97 authored lines, no findings.

@vercel

vercel Bot commented Nov 11, 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 12, 2026 2:00am UTC

Request Review

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

astracat-bot Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 12, 2026, 2:08 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: no current spec settles the new wording ("Enter a real date", "Enter a real date ({calendar})" and "Enter an available date") or when the message names the calendar, and the sentence added to spec:AST-111 AR3 is a new requirement in a draft record. An engineering owner records that decision by commenting /approve-spec <full head SHA> on this pull request; as an engineering owner, the author may do so.

One fix is needed either way:

  • DateTimeInput.calendar.test.tsx renames the test "rejects a date the calendar does not have and names the calendar", which the verification table of the DateTimeInput component spec (its FR11, AR5 row) still cites, so keep the old title or update that row.

The Gregorian cases in DateInput.calendar.test.tsx match "Enter a real date" by substring, so they would also pass if the calendar name were wrongly appended; an exact-text assertion would pin that case.

Claims and files checked
  • Claim: a typed date the calendar lacks shows "Enter a real date": verified (en.json:1219, DateInput.calendar.test.tsx:387-400).
  • Claim: the calendar is named only when the field's calendar differs from the provider's: verified (useTypedDate.ts:189-199, DateInput.calendar.test.tsx:121-133, :402-415).
  • Claim: a day ruled out by dateConstraints shows "Enter an available date": verified (en.json:1223, DateInput.calendar.test.tsx:417-425).
  • Claim: the old messages read as the description quotes: verified (base en.json).
  • Claim: the min and max messages do not change: verified (en.json:1223).
  • Claim: the rule reuses the comparison the field's description uses: verified (useTypedDate.ts:189-191, :239-241).
  • Claim: no locale catalog translates these keys: verified (only en.json of 30 catalogs).
  • Claim: the component specs' distinct message per rejection kind stays true: verified (en.json:1215, :1219, :1223).
  • Claim: the four evidence-table cases: verified from the code; the Gregorian case's test asserts only a substring.
  • Claim: the two named regression tests exist: verified (DateInput.calendar.test.tsx:402, :417).
  • Claim: 97 authored lines: verified.
  • Claim: changeset coverage passes: verified.
  • Claim: the test run, i18n catalog and runtime checks, knowledge check and pre-review findings pass: not confirmed here; CI has not run on this head yet.
  • Claim: no new public API: verified.
  • Claim: no internal context in public text: verified.
  • Claim: one defect is restored: not established; no current spec makes the released wording a defect, so it waits on the owner decision.
  • Claim: the survey of other date inputs and the standalone-name grammar: research context, not checked.
  • File .changeset/date-error-wording.md: clear.
  • File docs/specs/AST-111-calendar-systems/spec.md: needs owner approval.
  • File packages/core/locales/en.json: needs owner approval.
  • File packages/core/src/DateInput/useTypedDate.ts: clear.
  • File packages/core/src/DateInput/DateInput.calendar.test.tsx: substring assertion (non-blocking).
  • File packages/core/src/DateTimeInput/DateTimeInput.calendar.test.tsx: renamed test still cited by the component spec.

Automated review (maintainer link)

@github-actions

github-actions Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · 5205098

Storybook · Sandbox · built from this PR's head

Modified components

Component Size LoC Visual · A11y · RTL
DateTimeInput · Storybook 215.3 kB (+26 B) · 18.7 kB CSS (0) 3,631 (0) ✗ · ✓ · ✓
DateInput · Storybook 192.7 kB (+25 B) · 17.0 kB CSS (0) 6,038 (+3) ✗ · ✓ · ✓
PowerSearch 299.2 kB (+39 B) · 24.7 kB CSS (0) — — · — · —
Visual changes: 14 snapshots in 2 components

A change is a question for the reviewer, not a failure.

Component · story Before After Diff
DateInput · All Variations (neutral, light) before frame after frame diff frame
DateInput · All Variations (neutral, dark) before frame after frame diff frame
DateInput · Open Calendar Audit (neutral, light) before frame after frame diff frame
DateInput · Open Calendar Audit (neutral, dark) before frame after frame diff frame
DateInput · Open Calendar Audit (probe, dark) before frame after frame diff frame
DateInput · Open Calendar Audit (probe, light) before frame after frame diff frame
DateInput · Cleared Calendar Selection (neutral, light) before frame after frame diff frame
DateInput · Default (neutral, light) before frame after frame diff frame
DateTimeInput · Cleared Calendar Selection (neutral, light) before frame after frame diff frame
DateTimeInput · Default (neutral, light) before frame after frame diff frame
DateInput · Cleared Calendar Selection (neutral, dark) before frame after frame diff frame
DateInput · Default (neutral, dark) before frame after frame diff frame

2 more are in the run's visual report.

Package size: @astryxdesign/core 7.36 MB packed (+280 B); no new dependencies.

Touched components checked; add ci:run-visual, ci:run-a11y or ci:run-rtl to run the full suites.

Current run: CI concluded cancelled; parts of this report may be missing.


Generated by PR Enrichment workflow | View full report

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approval waits on an engineering owner's decision. No current spec settles the new wording ("Enter a real date", "Enter a real date ({calendar})" and "Enter an available date") or when the message names the calendar, and the sentence added to spec:AST-111 AR3 is a new requirement in a draft record. An engineering owner records that decision by commenting /approve-spec <full head SHA> on this pull request; as an engineering owner, the author may do so. The DateTimeInput test keeps the title its component spec cites and the Gregorian and provider-calendar cases now assert the exact text, so no other change is needed.

Claims and files checked
  • Claim: a typed date the calendar lacks shows "Enter a real date": verified (en.json:1219, DateInput.calendar.test.tsx:387-402).
  • Claim: the calendar is named, in parentheses, only when the field's calendar differs from the provider's: verified (useTypedDate.ts:189-199, DateInput.calendar.test.tsx:118, :128, :404-415).
  • Claim: a day that dateConstraints rules out shows "Enter an available date": verified (en.json:1223, DateInput.calendar.test.tsx:417-425).
  • Claim: the released messages read as the description quotes: verified (base en.json).
  • Claim: the min and max messages do not change: verified (en.json:1223).
  • Claim: the naming rule is the one the field's description already uses, computed in the same hook: verified (useTypedDate.ts:189-191, :239-241).
  • Claim: no locale catalog translates these keys: verified (only en.json of the 30 shipped catalogs).
  • Claim: the component specs' different message per rejection kind stays true: verified (en.json:1215, :1219, :1223).
  • Claim: the four evidence-table cases: verified from the code and tests.
  • Claim: the two named regression tests exist, and the Gregorian and provider-calendar cases assert the exact text: verified (DateInput.calendar.test.tsx:399, :404, :414, :417).
  • Claim: the changeset's three statements and its patch bump for Core: verified (.changeset/date-error-wording.md).
  • Claim: no new public API: verified from the source diff.
  • Claim: no internal context in public text: verified.
  • Claim: one defect is restored: not established; no current spec makes the released wording a defect, so it waits on the owner decision.
  • Claim: separable unsettled tagalongs were removed or split: not established; the dateConstraints wording stays, pursued explicitly and covered by the same owner decision.
  • Claim: the test run, i18n catalog and runtime checks, knowledge check, changeset coverage and pre-review results: not confirmed; CI skipped those jobs for this draft head, and the pre-review count of 97 lines describes the earlier commit (95 now).
  • Claim: the survey of other date inputs and the standalone-name grammar: research context, not checked.
  • File .changeset/date-error-wording.md: clear.
  • File docs/specs/AST-111-calendar-systems/spec.md: needs owner approval.
  • File packages/core/locales/en.json: needs owner approval.
  • File packages/core/src/DateInput/useTypedDate.ts: clear.
  • File packages/core/src/DateInput/DateInput.calendar.test.tsx: clear.
  • File packages/core/src/DateTimeInput/DateTimeInput.calendar.test.tsx: clear.

Automated review (maintainer link)

@nynexman4464

Copy link
Copy Markdown
Contributor Author

/approve-spec 5205098

@nynexman4464
nynexman4464 marked this pull request as ready for review November 11, 2026 22:03

@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 finished on this head yet.

An engineering owner's /approve-spec on this head settles the naming rule added to spec:AST-111 AR3 and the new wording ("Enter a real date", "Enter a real date ({calendar})" and "Enter an available date"). The change reuses the field's existing provider-calendar comparison, keeps a different message for each kind of rejection, and the tests pin the exact text, including the DateTimeInput test title its component spec cites.

  • Non-blocking: the Testing section's "97 authored lines" describes the first commit; this head has 95, so refresh that line with the other results once CI finishes.
Claims and files checked
  • Claim: a typed date the calendar lacks used to show "This date does not exist in the …": verified (base en.json:1219).
  • Claim: it now shows "Enter a real date": verified (en.json:1219, DateInput.calendar.test.tsx:387-402).
  • Claim: the calendar is named, in parentheses, only when the field's calendar differs from the app's: verified (useTypedDate.ts:189-199, DateInput.calendar.test.tsx:118, :128, :404-415).
  • Claim: a day that dateConstraints rules out shows "Enter an available date": verified (en.json:1223, DateInput.calendar.test.tsx:417-425).
  • Claim: the out-of-range messages do not change: verified (en.json:1223, the both, min and max branches).
  • Claim: the naming rule is the description's rule, computed by the same hook: verified (useTypedDate.ts:189-191, :239-241).
  • Claim: the calendar-systems record's AR3 gains one sentence: verified (spec.md:319-321), approved by an engineering owner on this head.
  • Claim: the component records' different message per rejection kind stays true: verified (en.json:1215, :1219, :1223).
  • Claim: no locale catalog translates these keys, so no translation is lost: verified (only en.json of the 30 catalogs).
  • Claim: the four evidence-table cases: verified from the code and tests.
  • Claim: the two named regression tests exist, and the Gregorian and provider-calendar cases assert the exact text: verified (DateInput.calendar.test.tsx:399, :404, :414, :417).
  • Claim: one defect is restored and no unsettled tagalong remains: owner-decided; the approval on this head covers the naming rule and all three wordings.
  • Claim: no new public API, default or interaction model: verified from the source diff.
  • Claim: no internal context in public text: verified.
  • Claim: the record edit adds no narration, status or open question: verified (spec.md:319-321).
  • Claim: the test run, i18n catalog and runtime checks, knowledge check and changeset coverage pass: not yet confirmed; CI has not finished on this head.
  • Claim: pre-review reports 97 authored lines and no findings: the count describes the first commit (95 at this head).
  • Claim: the survey of other date inputs and the standalone calendar-name grammar: research context, not a code claim.
  • Changeset: the three statements and the patch bump for Core: verified (.changeset/date-error-wording.md, en.json:1219, :1223, useTypedDate.ts:189-199).
  • File .changeset/date-error-wording.md: clear.
  • File docs/specs/AST-111-calendar-systems/spec.md: clear (owner-approved).
  • File packages/core/locales/en.json: clear.
  • File packages/core/src/DateInput/useTypedDate.ts: clear.
  • File packages/core/src/DateInput/DateInput.calendar.test.tsx: clear.
  • File packages/core/src/DateTimeInput/DateTimeInput.calendar.test.tsx: clear.

Automated review (maintainer link)

github-actions Bot added a commit that referenced this pull request Nov 12, 2026
github-actions Bot added a commit that referenced this pull request Nov 12, 2026
@nynexman4464

Copy link
Copy Markdown
Contributor Author

/approve-spec 44ed712

@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 finished on this head yet.

This head merges main into the branch and leaves the change itself as it was. An engineering owner's /approve-spec on this head settles the naming rule added to spec:AST-111 AR3 and the new wording ("Enter a real date", "Enter a real date ({calendar})" and "Enter an available date"). The change reuses the field's existing provider-calendar comparison and keeps a different message for each kind of rejection; the tests assert the exact text where no calendar name may appear and keep the DateTimeInput test title its component spec cites.

  • Non-blocking: the Testing section's "97 authored lines" describes the first commit; this head has 95, so refresh that line with the other results once CI finishes.
Claims and files checked
  • Claim: a typed date the calendar lacks used to show "This date does not exist in the …": verified (base en.json:1219).
  • Claim: it now shows "Enter a real date": verified (en.json:1219, DateInput.calendar.test.tsx:387-402).
  • Claim: the calendar is named, in parentheses, only when the field's calendar differs from the app's: verified (useTypedDate.ts:189-199, DateInput.calendar.test.tsx:118, :128, :404-415).
  • Claim: a day that dateConstraints rules out shows "Enter an available date": verified (en.json:1223, DateInput.calendar.test.tsx:417-425).
  • Claim: the out-of-range messages do not change: verified (en.json:1223, the both, min and max branches).
  • Claim: the naming rule is the description's rule, computed by the same hook: verified (useTypedDate.ts:189-191, :239-241).
  • Claim: the calendar name comes from the platform as a standalone name: verified for the source (calendarDateParser.ts:1374-1385); the grammar point is research context.
  • Claim: the calendar-systems record's AR3 gains one sentence: verified (spec.md:317-321), approved by an engineering owner on this head.
  • Claim: the component records' different message per rejection kind stays true: verified (en.json:1215, :1219, :1223).
  • Claim: no locale catalog translates these keys, so no translation is lost: verified (only en.json of the 30 catalogs).
  • Claim: the four evidence-table cases: verified from the code and tests.
  • Claim: the two named regression tests exist, and the Gregorian and provider-calendar cases assert the exact text: verified (DateInput.calendar.test.tsx:399, :404, :414, :417).
  • Claim: one defect is restored and no unsettled tagalong remains: owner-decided; the approval on this head covers the naming rule and all three wordings.
  • Claim: no new public API, default or interaction model: verified from the source diff.
  • Claim: no internal context in public text: verified.
  • Claim: the record edit adds no narration, status or open question: verified (spec.md:317-321).
  • Claim: the i18n catalog and runtime checks, the knowledge check and changeset coverage pass: verified by the repository checks that passed in CI on this head.
  • Claim: the unit test run (56 files, 1,859 tests) passes: not yet confirmed; CI's unit tests are still running on this head.
  • Claim: pre-review reports 97 authored lines and no findings: the count describes the first commit (95 at this head).
  • Claim: the survey of other date inputs: research context, not a code claim.
  • Changeset: the three statements and the patch bump for Core: verified (.changeset/date-error-wording.md, en.json:1219, :1223, useTypedDate.ts:189-199).
  • File .changeset/date-error-wording.md: clear.
  • File docs/specs/AST-111-calendar-systems/spec.md: clear (owner-approved).
  • File packages/core/locales/en.json: clear.
  • File packages/core/src/DateInput/useTypedDate.ts: clear.
  • File packages/core/src/DateInput/DateInput.calendar.test.tsx: clear.
  • File packages/core/src/DateTimeInput/DateTimeInput.calendar.test.tsx: clear.

Automated review (maintainer link)

@nynexman4464
nynexman4464 merged commit 4b24212 into main Nov 12, 2026
72 checks passed
github-actions Bot added a commit that referenced this pull request Nov 12, 2026
@github-actions
github-actions Bot deleted the nynexman4464/fix/date-error-wording branch November 12, 2026 06:06

This branch was successfully deployed

1 active deployment
Preview — 44ed7124 Deployed Nov 12, 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