diff --git a/apps/web/src/timestampFormat.test.ts b/apps/web/src/timestampFormat.test.ts index 1ac2b04a4bb9..f35c1c1fdbf8 100644 --- a/apps/web/src/timestampFormat.test.ts +++ b/apps/web/src/timestampFormat.test.ts @@ -176,6 +176,20 @@ describe("formatDayAwareTimestamp", () => { ); }); + it("uses the host locale for both the numeric date and wall-clock time", async () => { + vi.stubGlobal("window", { + desktopBridge: { getSystemLocale: () => "en-GB" }, + }); + vi.resetModules(); + + const { formatDayAwareTimestamp: formatWithHostLocale } = await import("./timestampFormat"); + const messageAt = iso(2026, 7, 12, 15, 44); + + expect(formatWithHostLocale(messageAt, "locale", now)).toBe("12/08 15:44"); + + vi.unstubAllGlobals(); + }); + it("returns an empty string for invalid input", () => { expect(formatDayAwareTimestamp("not-a-date", "12-hour", now)).toBe(""); }); diff --git a/apps/web/src/timestampFormat.ts b/apps/web/src/timestampFormat.ts index 5b57c5316e1d..c1c30a544573 100644 --- a/apps/web/src/timestampFormat.ts +++ b/apps/web/src/timestampFormat.ts @@ -127,11 +127,11 @@ export function formatShortTimestamp(isoDate: string, timestampFormat: Timestamp return getTimestampFormatter(timestampFormat, false).format(date); } -const numericDateFormatter = new Intl.DateTimeFormat(undefined, { +const numericDateFormatter = new Intl.DateTimeFormat(timestampLocale, { month: "numeric", day: "numeric", }); -const numericDateWithYearFormatter = new Intl.DateTimeFormat(undefined, { +const numericDateWithYearFormatter = new Intl.DateTimeFormat(timestampLocale, { month: "numeric", day: "numeric", year: "numeric",