Skip to content

Format dates through one module, in the event's locale and timezone - #119

Draft
arnavs-0 wants to merge 1 commit into
mainfrom
cleanup/date-formatters
Draft

arnavs-0 wants to merge 1 commit into
mainfrom
cleanup/date-formatters

Conversation

@arnavs-0

@arnavs-0 arnavs-0 commented Aug 18, 2026

Copy link
Copy Markdown
Member

No description provided.

Fourteen call sites each spelled out their own Intl options and had drifted
apart: some passed "en-US" and some passed undefined, and three fell back to
the bare toLocaleDateString()/toLocaleString() default ("8/17/2026") inside a
UI that reads "Aug 17, 2026" everywhere else.

lib/format/date.ts now owns the seven shapes actually in use. Each is named
for its output rather than its caller, so a new call site can pick one by
reading the sample.

Two deliberate behavior changes come with this:

- Locale and timezone are pinned rather than left to the runtime. An
  undefined locale resolves to the server's locale during SSR and the
  browser's on hydration, so every timestamp rendered on both sides was a
  hydration mismatch waiting to happen. Verified: formatter output is now
  identical under TZ=UTC and TZ=America/Los_Angeles.
- Timestamps read in event-local time for everyone. Previously an organizer
  in California saw different clock times than one in Ann Arbor for the same
  moment, and invite-expiry emails — rendered on the server — went out in the
  container's zone while labelling themselves with timeZoneName: "short".

The event timezone is hardcoded here for now; it moves to lib/config/event.ts
in the next commit.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant