authorgravatar for lucenz@proton.meSimone <lucenz@proton.me> 2026-09-06 05:52:07+02:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2026-09-05 22:52:07-05:00
log2c3353578098a9e55e203a72217abe993f97987e
treec09cb5958914db9ac7efc1d570c7aca71f7b403f
parentbfba7781681eaa03eb465ce3d9a4ec07bf952b78
signature Signed by PGP key B5690EEEBB952194

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


2 files changed, 20 insertions(+), 1 deletions(-)

apps/web/src/timestampFormat.test.ts+19
......@@ -52,6 +52,25 @@ describe("formatShortTimestamp", () => {
5252 });
5353});
5454
55describe("formatChatTimestampTooltip", () => {
56 afterEach(() => {
57 vi.restoreAllMocks();
58 vi.resetModules();
59 });
60
61 it.each(["de-DE", "it-IT"])("keeps the English date label in a %s runtime", async (locale) => {
62 const DateTimeFormat = Intl.DateTimeFormat;
63 vi.spyOn(Intl, "DateTimeFormat").mockImplementation(function (locales, options) {
64 return new DateTimeFormat(locales ?? locale, options);
65 });
66 vi.resetModules();
67 const { formatChatTimestampTooltip: format } = await import("./timestampFormat");
68 const date = new Date(2026, 5, 4, 14, 4).toISOString();
69
70 expect(format(date, "24-hour")).toBe("14:04, 4th June 2026");
71 });
72});
73
5574describe("formatExpiresInLabel", () => {
5675 beforeEach(() => {
5776 vi.useFakeTimers();
apps/web/src/timestampFormat.ts+1-1
......@@ -81,7 +81,7 @@ export function parseTimestampDate(isoDate: string): Date | null {
8181// Deliberately not the host locale: the tooltip's ordinal suffix and
8282// day-before-month order below are English, so a localized month alone would
8383// read "4th Juni 2026". Localizing the whole label is a separate change.
84const monthNameFormatter = new Intl.DateTimeFormat(undefined, { month: "long" });
84const monthNameFormatter = new Intl.DateTimeFormat("en-US", { month: "long" });
8585
8686function ordinalSuffix(day: number): string {
8787 const lastTwo = day % 100;