fix(store,due): poll the clock so today turns over after sleep

This commit is contained in:
hh committed 2026-09-26 03:47:43 +02:00
1 parent b415b17007
commit e7178c6d3f
3 files changed
+22 -39

No files matched your search

-9
View File
@@ -4,7 +4,6 @@ import {
dueLabel,
dueTone,
nextFriday,
untilMidnight,
} from "../src/lib/due";
describe("due helpers read the day they are given", () => {
@@ -26,12 +25,4 @@ describe("due helpers read the day they are given", () => {
expect(nextFriday("2026-08-23")).toBe("2026-08-28");
expect(nextFriday("2026-08-28")).toBe("2026-09-04");
});
it("arms the midnight timer for the coming midnight", () => {
const late = new Date(2026, 7, 23, 23, 59, 0);
expect(untilMidnight(late)).toBeGreaterThan(60_000);
expect(untilMidnight(late)).toBeLessThan(62_000);
const early = new Date(2026, 7, 23, 0, 0, 1);
expect(untilMidnight(early)).toBeGreaterThan(23 * 3_600_000);
});
});