Skip to content

Commit 9cb81b0

Browse files
committed
fix(web): use client locale for snooze descriptions
1 parent 7cc50c0 commit 9cb81b0

2 files changed

Lines changed: 15 additions & 2 deletions

File tree

‎apps/web/src/components/Sidebar.snooze.test.ts‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,4 +95,16 @@ describe("snoozeWakeDescription", () => {
9595
"18:00",
9696
);
9797
});
98+
99+
it("uses the client locale for weekday and calendar-date labels", () => {
100+
const weekdayWake = localDate(2026, 4, 13, 9);
101+
const dateWake = localDate(2026, 4, 20, 9);
102+
103+
expect(snoozeWakeDescription(weekdayWake.toISOString(), now, "locale", "de-DE")).toContain(
104+
weekdayWake.toLocaleDateString("de-DE", { weekday: "short" }),
105+
);
106+
expect(snoozeWakeDescription(dateWake.toISOString(), now, "locale", "de-DE")).toContain(
107+
dateWake.toLocaleDateString("de-DE", { month: "short", day: "numeric" }),
108+
);
109+
});
98110
});

‎apps/web/src/components/Sidebar.snooze.ts‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ export function snoozeWakeDescription(
4242
snoozedUntil: string,
4343
now: Date,
4444
timestampFormat: TimestampFormat,
45+
locale: string | undefined = getTimestampLocale(),
4546
): string {
4647
const wake = parseTimestampDate(snoozedUntil);
4748
if (wake === null) return "";
@@ -51,8 +52,8 @@ export function snoozeWakeDescription(
5152
const dayDelta = Math.floor((wake.getTime() - startOfToday.getTime()) / DAY_MS);
5253
if (dayDelta === 0) return time;
5354
if (dayDelta === 1) return `tomorrow ${time}`;
54-
const weekday = wake.toLocaleDateString(undefined, { weekday: "short" });
55+
const weekday = wake.toLocaleDateString(locale, { weekday: "short" });
5556
if (dayDelta < 7) return `${weekday} ${time}`;
56-
const date = wake.toLocaleDateString(undefined, { month: "short", day: "numeric" });
57+
const date = wake.toLocaleDateString(locale, { month: "short", day: "numeric" });
5758
return `${date}, ${time}`;
5859
}

0 commit comments

Comments
 (0)