Skip to content

perf(app): drop luxon for the three date operations that used it - #49876

Merged
Hona merged 1 commit into
v2from
drop-luxon
Sep 19, 2026
Merged

Hona merged 1 commit into
v2from
drop-luxon

Conversation

@Hona

@Hona Hona commented Sep 19, 2026

Copy link
Copy Markdown
Member

luxon is 68 KB of the renderer's 494 KB main chunk (source-map attribution) and initialises its locale machinery at boot. The app used it in three places:

where luxon now
providers/models/models.tsx — "released in the last six months" DateTime.fromISO(...).diffNow().as("months") Date.parse + a six-average-month window; unparseable dates are NaN and stay visible, as before
home/sessions/controller.tsx — today / yesterday / older grouping hasSame(now, "day") in local time a local calendar-day key (y*10000 + m*100 + d); yesterday via new Date(y, m, d - 1) so DST is handled by Date
session/files/session-context-format.ts — medium date-time toLocaleString(DateTime.DATETIME_MED) Intl.DateTimeFormat(locale, { year: numeric, month: short, day: numeric, hour: numeric, minute: numeric }) — the exact fields luxon's preset passes to Intl

The formatter output was verified byte-identical to luxon across 16 locales (en-US, en-GB, de, fr, es, pt-BR, ru, pl, tr, ja, ko, zh-CN, hi, ar-EG, th, vi) × 4 times of day, including the 24-hour midnight padding case.

luxon and @types/luxon are removed from packages/app (web and enterprise still depend on it). The one failing test in src/home is pre-existing (a client-only Solid API called in a server-side test) and identical without this change.

luxon added 68 KB to the renderer's main chunk and its locale machinery
ran at boot, for an ISO parse with a six-month window, same-local-day
grouping of sessions, and one medium date-time format. Date.parse, a
local calendar-day key and Intl.DateTimeFormat with the fields
DATETIME_MED passed to Intl do the same; the format output was verified
byte-identical across 16 locales.
@Hona
Hona requested a review from Brendonovich as a code owner September 19, 2026 01:36
Copilot AI lite review requested due to automatic review settings September 19, 2026 01:36

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@Hona
Hona enabled auto-merge (squash) September 19, 2026 02:00
@Hona
Hona disabled auto-merge September 19, 2026 02:00
@Hona
Hona merged commit 1c90e8f into v2 Sep 19, 2026
9 of 10 checks passed
@Hona
Hona deleted the drop-luxon branch September 19, 2026 02:00
jinhuang712 pushed a commit to jinhuang712/opencode that referenced this pull request Sep 26, 2026
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.

2 participants