diff --git a/tests/work-screens-my-day-earlier-alerts.dom.test.tsx b/tests/work-screens-my-day-earlier-alerts.dom.test.tsx index b3588171e1..2ca5f43f37 100644 --- a/tests/work-screens-my-day-earlier-alerts.dom.test.tsx +++ b/tests/work-screens-my-day-earlier-alerts.dom.test.tsx @@ -89,6 +89,10 @@ function renderPage() { } beforeEach(() => { + // Pin the clock to midday in Perth, so alerts made "minutes ago" stay under Today. + // On the real clock this file failed in the first minutes after Perth midnight. + vi.useFakeTimers({ toFake: ["Date"] }); + vi.setSystemTime(new Date("2026-10-15T04:00:00.000Z")); window.localStorage.clear(); resetExampleDataForTests(); worker.shown = []; @@ -108,6 +112,7 @@ beforeEach(() => { afterEach(() => { vi.restoreAllMocks(); + vi.useRealTimers(); cleanup(); window.localStorage.clear(); });