Start calendar weeks on Sunday in the admin display

Render the month grid header Sunday-first with a (weekdayOf + 1) % 7
leading pad, list Sunday first in the weekly-repeat picker, and order
recurrence summaries Sunday-first. The stored Monday=0 .. Sunday=6
weekday numbering is unchanged; a regression test pins it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-09-24 19:20:34 -04:00
co-authored by Claude Opus 5.5
parent 5650a1f5a2
commit 7c85b7bbd7
6 changed files with 74 additions and 8 deletions
+18
View File
@@ -58,6 +58,24 @@ describe("calendar helpers", () => {
expect(weekdayOf("2026-09-06")).toBe(6);
});
it("weekdayOf keeps the stored Monday=0 .. Sunday=6 numbering (display order is separate)", () => {
// A full known week plus dates across month and year ends.
expect(
[
"2026-09-07",
"2026-09-08",
"2026-09-09",
"2026-09-10",
"2026-09-11",
"2026-09-12",
"2026-09-13",
].map(weekdayOf),
).toEqual([0, 1, 2, 3, 4, 5, 6]);
expect(weekdayOf("2026-11-01")).toBe(6); // Sunday
expect(weekdayOf("2027-01-01")).toBe(4); // Friday
expect(weekdayOf("2024-02-29")).toBe(3); // Thursday
});
it("monthStart shifts across year ends", () => {
expect(monthStart("2026-12-15", 1)).toBe("2027-01-01");
expect(monthStart("2026-01-31", -1)).toBe("2025-12-01");