Skip to content
Source
Sign inSign up
Open History to see the last commit

customSnoozeDate.test.ts

23 lines847 Bytes

1import { describe, expect, it } from "vite-plus/test";
2​
3import { applySnoozePickerDate, snoozeDateToPickerDate } from "./customSnoozeDate";
4​
5describe("custom snooze calendar conversion", () => {
6 it("passes the local calendar day to Compose without shifting it across time zones", () => {
7 const date = new Date(2026, 8, 17, 0, 30);
8 expect(snoozeDateToPickerDate(date)).toBe("2026-09-17T00:00:00.000Z");
9 });
10​
11 it("applies Compose's UTC calendar day while retaining the local time", () => {
12 const date = new Date(2026, 8, 16, 23, 45);
13 const next = applySnoozePickerDate(date, new Date("2026-09-20T00:00:00Z"));
14 expect([
15 next.getFullYear(),
16 next.getMonth(),
17 next.getDate(),
18 next.getHours(),
19 next.getMinutes(),
20 ]).toEqual([2026, 8, 20, 23, 45]);
21 expect(date.getDate()).toBe(16);
22 });
23});