Repository navigation
feat(dates): every date and time through one Intl formatter, in the visitor's own format - #509
Merged
Merged
Conversation
…isitor's own format
Dates and times now go through src/lib/time.ts in regionalLocale(locale):
the browser's first language decides, so an en-GB browser reads
"17:45–18:45" and "Wed 18 Nov", en-US "5:45 – 6:45 PM" and "Wed, Nov 18",
and a browser whose first language is another keeps that language's clock
on the English page (cs-CZ "17:45", a Brazilian browser on en-BR-u-hc-h23).
- Times use timeStyle 'short', so whole hours keep their minutes.
- A range that wraps past midnight and runs 12 hours or more writes both
day periods ("5:00 PM – 12:00 PM", not "5:00 – 12:00 PM").
- A year joins a date only when it is not this year.
- Callers: useEventDisplay, the filter time labels, ActiveFilterPills,
SearchFilters (weekdayNames instead of luxon's Info.weekdays), the
registration dates, and the calendar header; the Schedule-X grid runs
regional English as en-GB or en-US by date order (scheduleXLocale).
- Distances follow the same locale: miles for a UK or US region.
- src/AGENTS.md gains the "Dates and times" rule.
Main's #380 clock rule is unchanged.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
- useLocale() returns formatLocale, so callers stop deriving regionalLocale
themselves, and formatTimePeriods takes it like its siblings. The specs'
useLocale mocks pin it, so they no longer read the machine's own locale
(use-event-display.test.ts failed on an en-GB machine).
- formatTimeRange: the wrap-past-midnight join fires only when formatRange
actually collapsed a day period, reading the separator off the same parts;
a 24-hour locale keeps its own range and suffix ("17:00–12:00 Uhr").
- wallClock replaces events.ts's hourClock; formatDate drops its test-only
`now` for luxon's Settings.now; usesMiles and dayFirst lose catches that
guarded nothing; scheduleXLocale loses an unreachable row.
- Shorter comments and src/AGENTS.md rule; duplicate tests removed.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The regional locale hands Schedule-X the browser's own Portuguese tag (pt-PT, pt), which matched no entry and fell back to en-US. Key the table by language so every Portuguese tag runs pt-BR, as main did. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…'s locale Co-Authored-By: Claude Opus 5.5 <[email protected]>
…tches Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Contributor
|
🤖 no session running recent dispatchesWritten by the sydevs dispatcher. Sessions never edit this comment. |
…ng, not the formatters scheduleXLocale is calendar configuration with one caller, so it moves from lib/time.ts into lib/shape/calendar.ts beside the other Schedule-X helpers. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts: # CHANGELOG.md
12 tasks
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
sahajatlas-design | 40ea153 | Nov 26 2026, 10:30 PM |
# Conflicts: # CHANGELOG.md
…t stop The walk presses Tab once per tabbable element, but a roving-tabindex group (#501's weekday picker) is one Tab stop holding seven, so on molecules--form-field the walk outlasted the page, wrapped to ff-name and reported it as a backwards jump. main has failed the gate since #501 and #510 landed together. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
A stop the page rendered after the audit carries no data-a11y-order, and Number(null) is 0, so views--event-·-sticky-register failed tab-order at random whenever the audit read the story before it finished rendering. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Contributor
|
The session for review-pr did not finish after 3 attempts. I have stopped retrying. A mention ( 🤖 sydevs dispatcher |
6 tasks
# Conflicts: # src/components/molecules/EventListItem/EventListItem.tsx
# Conflicts: # CHANGELOG.md # src/components/molecules/SearchFilters/SearchFilters.test.tsx # src/components/molecules/SearchFilters/SearchFilters.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
@/lib/time, in the visitor's browser region: en-GB reads "17:45–18:45" and "Wed 18 Nov", en-US reads "5:45 – 6:45 PM" and "Wed, Nov 18".de-DE, de, en-US, enread "17:45", and pt-BR also reads "17:45".Change outline
Flow — where the format locale comes from
The format locale is now worked out once, in
useLocale(), and every formatter takes it. Before this, each one received the page locale (en), which meant US English for everyone.Behaviour —
formatTimeRangeTimes use the locale's own
timeStyle: 'short', so whole hours keep their minutes. A range that wraps past midnight now keeps both day periods.Behaviour — dates, the calendar grid, distances
formatDate(at, locale, { weekday }) src/lib/time.ts - year always (header), never (cards) + year only when at.year ≠ this year scheduleXLocale(formatLocale) src/lib/shape/calendar.ts (was SX_LOCALES in CalendarView) + English → en-GB or en-US by the tag's date order (en-CZ → en-GB) + else by language: de → de-DE …, pt → pt-BR (any Portuguese browser) usesMiles(locale) src/lib/distance.ts - exact tag in { en-us, en-gb } + tag's region is US or GB # de-GB, en-GB-u-hc-h23 → miles; en → kmUnchanged on purpose
The #380 clock rule is untouched. An in-person time names its city's clock only when the visitor's clock differs. An online class always names the visitor's clock, and the host line names the host's city too (option A).
Preview
Preview pending. Once the PR's Workers preview publishes, these routes show the change:
/gb/south-east/london/1817: the class time and next-session date/search?format=online: the visitor's clock named on every online class/calendar?region=gb: the header date and the grid's timesEvery page follows the reviewer's own browser language and time zone.
Test results
.claude/skills/pr-prep/check.sh, lint + typecheck +test:run) ✓: 207 files passed.src/lib/time.test.tsandsrc/lib/events.time.test.tscover both clocks, cs-CZ, pt-BR, es-MX,de-DE, de, en-US, enagainsten-US, de-DE, the wrap past midnight in en-US, en-GB and de, the year rule, and Schedule-X locales including pt-PT.src/lib/distance.test.tscovers the region rule.LANG=en_GB.UTF-8, 117 files). TheiruseLocalemocks now pinformatLocale.git grep -n -e hour12 -e "'a'" -e toLocaleTimeString -- src ':!src/lib/time.ts'finds nothing new.Manual verification
/gb/south-east/london/1817reads "Every Friday · 17:45–18:45". With time zone Europe/Prague it reads "17:45–18:45 London time".de-DE, de, en-US, en, it reads "17:45–18:45 London time". With pt-BR it reads "17:45 – 18:45", and with es-MX "5:45 – 6:45 PM". (I checked all of these locally in Chromium.)/search?format=onlinenames the visitor's clock on every online class./calendar?region=gbshows the same 24-hour clock as the class pages.Notes for reviewer
TimeStep,WeekListorDayHeading, soformatDayHeading,formatLongDate,formatDateRangeandformatTimeare not here yet. They arrive with those cards.capitalize.formatRelativeDatealready sentence-cases ("Next week"), andcapitalizewould title-case every word, including lowercase month names in other languages.timePeriodRangesreturns[]for a whole-day cover, so this never reaches the formatter.withEndTime).navigator.languagesnever carries extensions in practice, and every consumer takes a full tag.dayFirstandusesMilescost per call: about 30 µs per calendar mount and about 1 µs per list row. Not cached.Detail
ux/all-proposals, trimmed to what main has callers for. The forced Englishhour12those built on (1d58d7d, 5488ec0) was never on main./simplifyran with four angles. As a result,formatLocalemoved intouseLocale(), the wrap guard reads Intl's own parts instead of a 12-hour proxy (which restored German's "Uhr"), and duplicate tests and helpers were removed.scheduleXLocalemoved beside the calendar shaping code, and thesrc/AGENTS.mdrule names the module rather than listing its exports./code-review mediumran too. As a result, any Portuguese browser maps to Schedule-X pt-BR,navigator.languagesis guarded, and spec comments no longer name a person.src/AGENTS.md, aformatLocalenote indocs/rules/i18n-and-state.md, and aCHANGELOG.mdentry (visible behaviour, with no parameter, origin or CSP change).🤖 Generated with Claude Code