mirror of
https://github.com/Sea-Haven-Industries/seahaven-ap.git
synced 2026-10-04 12:31:58 +00:00
16 lines
656 B
TypeScript
16 lines
656 B
TypeScript
|
|
import { describe, expect, it } from "vitest";
|
||
|
|
import { formatRelativeFromIsoDate, formatSlashDate } from "@/dashboard/invoice-date-format";
|
||
|
|
|
||
|
|
describe("invoice column date helpers (AP-47)", () => {
|
||
|
|
it("formats ISO dates as MM/DD/YYYY", () => {
|
||
|
|
expect(formatSlashDate("2026-04-10")).toBe("04/10/2026");
|
||
|
|
});
|
||
|
|
|
||
|
|
it("formats relative ages from a fixed now", () => {
|
||
|
|
const now = new Date("2026-08-11T12:00:00");
|
||
|
|
expect(formatRelativeFromIsoDate("2026-08-11", now)).toBe("today");
|
||
|
|
expect(formatRelativeFromIsoDate("2026-08-10", now)).toBe("1 day ago");
|
||
|
|
expect(formatRelativeFromIsoDate("2026-02-11", now)).toBe("6 months ago");
|
||
|
|
});
|
||
|
|
});
|