Skip to content
TypeScript

fix(web): keep timestamp tooltip dates in English (#10256)

Simone2c3353578098
diff --git a/apps/web/src/timestampFormat.test.ts b/apps/web/src/timestampFormat.test.ts
index ca73095f7fd..8c6287010d8 100644
--- a/apps/web/src/timestampFormat.test.ts
+++ b/apps/web/src/timestampFormat.test.ts
@@ -52,6 +52,25 @@ describe("formatShortTimestamp", () => {
});
});
+describe("formatChatTimestampTooltip", () => {
+ afterEach(() => {
+ vi.restoreAllMocks();
+ vi.resetModules();
+ });
+
+ it.each(["de-DE", "it-IT"])("keeps the English date label in a %s runtime", async (locale) => {
+ const DateTimeFormat = Intl.DateTimeFormat;
+ vi.spyOn(Intl, "DateTimeFormat").mockImplementation(function (locales, options) {
+ return new DateTimeFormat(locales ?? locale, options);
+ });
+ vi.resetModules();
+ const { formatChatTimestampTooltip: format } = await import("./timestampFormat");
+ const date = new Date(2026, 5, 4, 14, 4).toISOString();
+
+ expect(format(date, "24-hour")).toBe("14:04, 4th June 2026");
+ });
+});
+
describe("formatExpiresInLabel", () => {
beforeEach(() => {
vi.useFakeTimers();
diff --git a/apps/web/src/timestampFormat.ts b/apps/web/src/timestampFormat.ts
index 0f87204efde..9dd463bb50f 100644
--- a/apps/web/src/timestampFormat.ts
+++ b/apps/web/src/timestampFormat.ts
@@ -81,7 +81,7 @@ export function parseTimestampDate(isoDate: string): Date | null {
// Deliberately not the host locale: the tooltip's ordinal suffix and
// day-before-month order below are English, so a localized month alone would
// read "4th Juni 2026". Localizing the whole label is a separate change.
-const monthNameFormatter = new Intl.DateTimeFormat(undefined, { month: "long" });
+const monthNameFormatter = new Intl.DateTimeFormat("en-US", { month: "long" });
function ordinalSuffix(day: number): string {
const lastTwo = day % 100;