chore: scaffold Next.js + Prisma schema + dev MariaDB
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c4cee91ed7
commit
8d41c2fffe
27 files changed
+9616
No files matched your search
@@ -0,0 +1,38 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
addMonths,
|
||||
currentMonthParis,
|
||||
daysInMonth,
|
||||
formatDateFr,
|
||||
fromIsoDate,
|
||||
monthLabelFr,
|
||||
monthOf,
|
||||
toIsoDate,
|
||||
todayParis,
|
||||
} from "@/lib/dates";
|
||||
|
||||
describe("dates", () => {
|
||||
it("todayParis follows the Paris calendar day, not UTC", () => {
|
||||
expect(todayParis(new Date("2026-10-31T23:30:00Z"))).toBe("2026-11-01");
|
||||
expect(todayParis(new Date("2026-10-31T22:30:00Z"))).toBe("2026-10-31");
|
||||
expect(currentMonthParis(new Date("2026-10-31T23:30:00Z"))).toBe("2026-11");
|
||||
});
|
||||
|
||||
it("does month arithmetic on strings", () => {
|
||||
expect(monthOf("2026-10-31")).toBe("2026-10");
|
||||
expect(addMonths("2026-11", 3)).toBe("2027-02");
|
||||
expect(addMonths("2026-01", -1)).toBe("2025-12");
|
||||
expect(daysInMonth("2028-02")).toBe(29);
|
||||
expect(daysInMonth("2027-02")).toBe(28);
|
||||
});
|
||||
|
||||
it("converts Prisma @db.Date values without timezone drift", () => {
|
||||
expect(toIsoDate(new Date("2026-10-31T00:00:00Z"))).toBe("2026-10-31");
|
||||
expect(fromIsoDate("2026-10-31").toISOString()).toBe("2026-10-31T00:00:00.000Z");
|
||||
});
|
||||
|
||||
it("formats for French display", () => {
|
||||
expect(formatDateFr("2026-10-05")).toBe("05/10/2026");
|
||||
expect(monthLabelFr("2026-10")).toBe("Octobre 2026");
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user