assessment-model/docs/adr
Daniel Roth c96d964d24 feat(dates): restore a calendar picker behind DateInput
Dropping `<input type="date">` for the dd/mm/yyyy mask also dropped its
calendar, leaving typing as the only way to enter a date. ADR-0019 accepted
that cost but named the remedy: add a picker *behind* `DateInput`, writing the
same ISO value, rather than revert to the native control. That was felt
immediately in use, so this does it.

`DateInput` now renders a calendar button inside the field's right edge and a
Calendar in a Radix popover. Typing and picking are equal routes to the same
value — picking fills the text, typing moves the grid — so neither is
privileged and the two cannot disagree. The trigger is `type="button"` so it
cannot submit the form, and carries an aria-label, a bare icon having no
accessible name.

The calendar wrapper is written by hand rather than taken from the shadcn
registry: the published template targets react-day-picker v8/v9, whose
`classNames` keys differ from the `UI` enum v10 uses. It defaults to the enGB
locale, which carries `weekStartsOn: 1`, so the grid starts on Monday without
being told to.

The delicate part is the `Date` boundary. A calendar works in `Date`s, and
both obvious conversions are wrong: `new Date("2026-03-01")` is midnight UTC,
which is 29 February west of Greenwich, and `toISOString()` shifts the day back
the other way. So `isoToLocalDate` and `localDateToIso` build and read local
parts, and they are the only two functions in `src/utils/dates.ts` that touch
`Date` at all — everything else stays string-only. The round trip is tested
across a full month rather than at a sample day, because the failure only
appears on some days in some zones; the suite was also run under
TZ=America/Los_Angeles and TZ=Pacific/Auckland.

Dependencies: react-day-picker and date-fns, the latter already present
transitively and now direct at v4. `@tremor/react` bundles react-day-picker v8
nested and npm kept it isolated on date-fns v3, so nothing existing changed
version; no Tremor DatePicker is used anywhere in src, so there is no second
copy in the bundle. The alternative was a hand-rolled month grid with no
dependency, rejected because keyboard navigation and ARIA on a calendar are
easy to get subtly wrong and not worth owning.

ADR-0019's "the native calendar picker is gone" consequence was now false and
has been rewritten.

TESTS: tsc --noEmit and ESLint clean; vitest 582 passing (53 files), 24 of them
for the date helpers. NOT verified in a browser — this project has no jsdom or
testing-library, and `next build` was not run because it would statically
render pages against a DATABASE_URL still pointing at production. The new
Cypress case, which picks 17 March from the grid and expects 17/03/2026 in the
field, is unrun like the rest of that spec.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-22 15:39:11 +00:00
..
0003-app-authored-scenarios.md feat(scenarios): portfolio Scenarios tab — gallery, detail, creation journey 2026-07-06 08:34:47 +00:00
0007-postcode-search-creates-properties.md fix(postcode-search): classify RH (HMO) family as addable residential 2026-07-09 10:33:07 +00:00
0008-modelling-runs-filters-to-distributor.md feat(modelling-runs): run config on tasks.inputs; backend contract updates 2026-07-07 10:46:29 +00:00
0009-portfolio-organisation-is-per-user.md docs(adr): 0009 — portfolio organisation is per-user, not shared 2026-07-07 21:11:21 +00:00
0011-app-owned-task-marker-in-task-source.md feat(live-reporting): bulk document download from the Documents tab 2026-07-08 14:11:42 +00:00
0012-portfolio-list-resolves-descriptors-via-override-precedence.md docs(portfolio): ADR-0012 — list resolves descriptors via override precedence 2026-07-10 23:21:21 +00:00
0013-tags-are-app-owned-property-groupings.md docs: ADR-0013 tagging system + CONTEXT (Bulk tag assignment, Run filter tags) 2026-07-13 15:45:14 +00:00
0014-epc-cards-count-certificates-not-predictions.md fix(reporting): EPC cards count certificates, not predictions (ADR-0014) 2026-07-14 12:19:02 +00:00
0018-ara-projects-supersedes-hubspot-live-projects.md docs(ara-projects): ADR-0018 + CONTEXT.md Ara Projects domain language 2026-07-21 08:30:32 +00:00
0019-uk-date-format-in-form-inputs.md feat(dates): restore a calendar picker behind DateInput 2026-07-22 15:39:11 +00:00