fix(desktop): timestamps follow the OS locale instead of en-US #6190
main fromrefs/pull/6190/head·merged by juliusmarminge View on GitHubFixes #6178.
Problem#
On the packaged desktop app, the default Timestamp format: Locale setting always renders US 12-hour times — 3:44 PM on a machine whose region asks for 15:44.
The app ships only the en-US Chromium locale pak (DESKTOP_ELECTRON_LANGUAGES, scripts/build-desktop-artifact.ts:629), and Chromium resolves its default Intl locale from the application locale rather than from the OS. Passing undefined to Intl.DateTimeFormat in the renderer therefore means en-US however the machine is configured, so the "locale" branch of getTimestampFormatOptions — which deliberately omits hour12 and defers to the runtime — silently means "US 12-hour" on desktop. DEFAULT_TIMESTAMP_FORMAT is "locale", so this is the out-of-the-box experience for every desktop user outside the US.
Measured inside the packaged renderer (0.0.33, macOS set to en_GB):
{
intlDefaultLocale: "en-US", // ← should be en-GB
navigatorLanguages: ["en-US", "en-GB"],
renderedLikeT3: "4:04 PM", // Intl.DateTimeFormat(undefined, { hour: "numeric", minute: "2-digit" })
withExplicitEnGB: "16:04",
timeZone: "Europe/London" // ← correct
}
The time zone resolving correctly while the locale does not is the tell: the OS is reachable from the process, and it is specifically the application locale that the pak trim pins.
Fix#
Read the OS locale in the main process with app.getSystemLocale() — which the pak trim does not affect, unlike app.getLocale() — expose it over the existing desktop bridge, and format timestamps with it. The bridge member follows getAppBranding: a sync sendSync getter, so the cached, synchronous formatter needs no async plumbing.
Web is unchanged: with no bridge present the resolver returns undefined and the browser keeps resolving its own locale, which is already correct there.
resolveTimestampLocale normalizes POSIX-style tags (en_GB → en-GB) and falls back to the runtime default rather than throwing if the host ever reports something ICU rejects, since the formatter backs every timestamp in the UI.
Before / after#
Chat timestamps, rendered by the real client under each locale. Same fixture, same crop; only the locale the formatter receives differs.
Before (en-US — what desktop shows today) | After (OS locale en-GB) |
|---|---|
![]() | ![]() |
A note on how these were produced, so the evidence is not overstated: the bug does not reproduce in a dev run, because electronLanguages is an electron-builder packaging option and pnpm start has every locale pak. These are the web client driven under a locale-pinned Chromium context — en-US for before, the OS locale en-GB for after — which is exactly the pair of locales the formatter receives on either side of this change. The IPC half is covered by types and by the getAppBranding precedent it mirrors, not by these images.
Surfaces#
- Desktop — the only surface affected, and the only one changed.
- Web — unaffected; browsers resolve their own locale correctly, and the resolver returns
undefinedwithout a bridge. - Mobile — unaffected; React Native has no Chromium pak trim.
- Contracts —
DesktopBridgegains one optional member. - Docs — no user docs describe timestamp formatting, so none changed.
Out of scope#
Three other call sites format with an implicit locale and are wrong on desktop for the same reason. Left alone to keep this to one concern; happy to follow up:
apps/web/src/components/settings/ConnectionsSettings.tsx:144apps/web/src/components/clerk/MobileClientsUserProfilePage.logic.ts:3packages/client-runtime/src/state/threadSettled.ts:300(snooze preset labels)
Testing#
resolveTimestampLocale is unit tested for the tag it picks and for the hour cycle that results, including the en-GB → 15:44 / en-US → 3:44 PM pair. ElectronApp.test.ts covers the OS-locale passthrough and the POSIX normalization. Targeted vp test run on both files (25 and 8 passing), plus typecheck and lint on the three touched packages.
Four other ElectronApp test stubs gained the new systemLocale member. Those four are among 22 desktop test files that fail to import in my environment on main — an unrelated vi.mock/electron issue, identical before and after this change — so they are type-correct but I could not execute them locally. ElectronApp.test.ts itself is not affected and runs green.
Written by Claude Opus 5 in T3 Code.
Note
Low Risk Localized display-only timestamp formatting on desktop; web unchanged. Fallbacks avoid throws on bad locale tags.
Overview
Fixes packaged desktop timestamps always rendering as US 12-hour when Timestamp format: Locale is selected, because Chromium’s default Intl locale is pinned to en-US (only that locale pak ships).
The main process now reads Electron.app.getSystemLocale(), normalizes POSIX tags (en_GB → en-GB), and exposes the result via a new sync getSystemLocale IPC path on desktopBridge (mirroring getAppBranding).
In timestampFormat.ts, resolveTimestampLocale validates the host tag and feeds it into cached Intl.DateTimeFormat instances so wall-clock times follow the OS (e.g. 15:44 for en-GB). Without a bridge (web), behavior is unchanged (undefined → browser default). Invalid tags fall back instead of breaking the UI.
DesktopBridge gains optional getSystemLocale. Desktop test stubs pick up systemLocale on ElectronApp; new unit tests cover locale resolution and Electron passthrough/normalization.
Note
Fix timestamp formatting to use OS locale instead of en-US#
- Adds
systemLocaleto theElectronAppservice, readingElectron.app.getSystemLocale()and normalizing POSIX-style tags (e.g.en_GB→en-GB). - Exposes the locale to the renderer via a new synchronous IPC method (
getSystemLocale) andwindow.desktopBridge.getSystemLocale(). - Adds
resolveTimestampLocalein timestampFormat.ts to validate the host-provided locale usingIntl.DateTimeFormat.supportedLocalesOf, falling back to the runtime default on invalid or missing values. - All
Intl.DateTimeFormattimestamp formatters now use the resolved OS locale instead of an impliciten-USdefault. - Behavioral Change: timestamps in the desktop app will now render according to the OS locale (e.g. 24-hour clock for
en-GB), which may differ visually from previous output.
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:M
Approvability#
Verdict: Approved 0fd360a
This is a focused bug fix that makes desktop timestamps respect the OS locale instead of being hardcoded to en-US. The implementation is self-contained, well-tested, and properly handles edge cases like POSIX locale format normalization.
You can customize Macroscope's approvability policy. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).Pushed a follow-up commit for the review. Rebased onto latest
main.Fixed — mixed-language tooltips. Correct, and it was a regression this PR introduced.
formatChatTimestampTooltipbuilds${time}, ${day}${ordinalSuffix} ${month} ${year}, where the ordinal suffix and the day-before-month order are hardcoded English, so localizing the month alone really does yield15:44, 4th Juni 2026.monthNameFormatteris back on the runtime locale with a comment recording why, which also drops a line this fix never needed. Localizing that whole label is a separate change.Fixed — adapter boundary. POSIX normalization (
en_GB→en-GB) moved toElectronApp.systemLocale, where the macOSNSLocalebehavior that causes it belongs, and the packaging exposition left the renderer. The renderer still falls back rather than throwing on a tag it cannot use — that guard is not platform knowledge, it is that this formatter backs every timestamp in the UI and aRangeErrorthere would blank all of them.Fixed — desktop coverage. Two tests added to
ElectronApp.test.ts, for the passthrough and for the normalization. Worth correcting one point: that file is not among the desktop tests that fail to import, and it runs green locally (6 → 8). The import failures are a separate pre-existingvi.mock/electronissue affecting 22 files identically onmain; four of them happen to holdElectronAppstubs that needed the new member.Not doing — user documentation.
docs/user/has no page covering timestamps, appearance, or the Settings surface this lives on, so there is nothing to update; the rule points at behavior changes a user would notice, and this restores the behavior the existing setting already promises. Writing a new user-docs page to carry a bug fix is a second concern, and I would rather you tell me you want one than have it arrive unasked.Not doing — shared
ElectronApptest builder. Agreed on the smell, but collapsing four unrelated test files into a shared stub is exactly the "also" that gets a PR split. Happy to do it separately if you want it.Verification after the change:
ElectronApp.test.ts8 passing,timestampFormat.test.ts25 passing, typecheck and lint clean on the three touched packages. The before/after images are unaffected — they showformatShortTimestampin the chat timeline, not the tooltip.macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes
One consistency issue found in
Posted via Macroscope — UI Consistencyapps/web/src/timestampFormat.ts: the day-aware timestamp now mixes the host locale (time) with the runtime-default locale (numeric date). Details inline.@@ -51,3 +84,6 @@5184 return getTimestampFormatter(timestampFormat, true).format(date);5285 }538687+// Deliberately not the host locale: the tooltip's ordinal suffix and88+// day-before-month order below are English, so a localized month alone would89+// read "4th Juni 2026". Localizing the whole label is a separate change.The English-tooltip exception is well justified, but the two numeric date formatters below (
numericDateFormatter,numericDateWithYearFormatter) are still built withundefinedwhile the time formatter now usestimestampLocale.formatDayAwareTimestampconcatenates the two, so on packaged desktop — where the runtime default is pinned toen-US— anen-GBmachine renders8/13 15:44instead of13/08 15:44, i.e. UK hour cycle with US month/day order in the same label. That also contradicts theformatDayAwareTimestampdocstring, which promises "locale digit order".These formatters emit no English words, so the reason given here for
Posted via Macroscope — UI ConsistencymonthNameFormatterdoesn't apply to them; suggest passingtimestampLocaleto both (they are declared after thetimestampLocalebinding, so no reordering is needed), or adding a short note if leaving them on the runtime default is deliberate.Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the [Cursor dashboard](https://www.cursor.com/dashboard/bugbot).
Want fixes drafted automatically? Bugbot Autofix can create code changes for findings. A team admin can enable Autofix in the Cursor dashboard.
Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 244ca169ca860663e7229c1b6e9f176c9c06a9f0. Configure [here](https://www.cursor.com/dashboard/bugbot).@@ -51,3 +84,6 @@5184 return getTimestampFormatter(timestampFormat, true).format(date);5285 }538687+// Deliberately not the host locale: the tooltip's ordinal suffix and88+// day-before-month order below are English, so a localized month alone would89+// read "4th Juni 2026". Localizing the whole label is a separate change.Chat dates stay US-ordered#
Medium Severity
formatDayAwareTimestampnow formats the time withtimestampLocalebut still builds the date prefix vianumericDateFormatterandnumericDateWithYearFormatteron the runtime default. On packaged desktop that default staysen-US, so older chat timestamps pair an OS-locale time with USM/Dorder. UnlikemonthNameFormatter, these numeric formatters have no English-only scaffolding that would make the host locale unsafe.Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 244ca169ca860663e7229c1b6e9f176c9c06a9f0. Configure [here](https://www.cursor.com/dashboard/bugbot).Additional Locations (1)
juliusmarminge merged thisb72d5d7
juliusmarminge closed this
The current head still has the date-prefix locale bug identified by Macroscope and Bugbot. I prepared and verified the focused fix, but
maintainerCanModifyis disabled and GitHub rejected the guarded push to the fork.Please update both
numericDateFormatterandnumericDateWithYearFormatterinapps/web/src/timestampFormat.tsto constructIntl.DateTimeFormat(timestampLocale, ...), and add coverage proving anen-GBdesktop host renders an older chat timestamp as12/08 15:44rather than mixing8/12with a 24-hour time.Verified locally against head
244ca169ca860663e7229c1b6e9f176c9c06a9f0: 39 focused tests passed; targeted lint and format passed; web, desktop, and contracts typechecks passed. Auto-merge should remain disabled until the actionable review is fixed; GitHub currently rejects the disable-auto-merge mutation for this PR.
Sign in to join this conversation.



Important
Review skipped#
Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
.coderabbit.yamlfile in this repository. To trigger a single review, invoke the@coderabbitai reviewcommand.⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID:
ebac7ab7-a9e2-4012-8f24-653766367fbaYou can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share