1import { describe, expect, it } from "vite-plus/test";
2
3import { formatDayAwareTimestamp, formatUpcomingTimestamp } from "./timestampFormat";
4
5describe("timestamps in an explicit time zone", () => {
6 // 23:00 UTC on July 1 is 7 PM on July 1 in New York, whatever the host zone.
7 const now = Date.parse("2026-07-01T23:00:00.000Z");
8 const zone = "America/New_York";
9
10 it("picks relative days from the calendar in that zone", () => {
11 expect(formatUpcomingTimestamp("2026-07-02T00:30:00.000Z", "12-hour", now, zone)).not.toMatch(
12 /tomorrow/,
13 );
14 expect(formatUpcomingTimestamp("2026-07-02T05:30:00.000Z", "12-hour", now, zone)).toMatch(
15 /^tomorrow at /,
16 );
17 expect(formatDayAwareTimestamp("2026-07-01T03:30:00.000Z", "12-hour", now, zone)).toMatch(
18 /^yesterday at /,
19 );
20 });
21});