From 592f44eb3220b57f619c69ce37da0ed3e0493e7e Mon Sep 17 00:00:00 2001 From: Alex van Andel Date: Sat, 5 Apr 2025 00:26:41 +0100 Subject: [PATCH] fix: broken getBusyTimes test in TZ!=UTC (#20555) --- packages/lib/getBusyTimes.test.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/lib/getBusyTimes.test.ts b/packages/lib/getBusyTimes.test.ts index 1da126914e..0489e06359 100644 --- a/packages/lib/getBusyTimes.test.ts +++ b/packages/lib/getBusyTimes.test.ts @@ -71,14 +71,14 @@ describe("getBusyTimes", () => { }); expect(busyTimes).toEqual([ expect.objectContaining({ - start: new Date(`${tomorrowDate}T10:00:00.000Z`), - end: new Date(`${tomorrowDate}T11:00:00.000Z`), + start: dayjs(`${tomorrowDate}`).startOf("day").set("hour", 10).toDate(), + end: dayjs(`${tomorrowDate}`).startOf("day").set("hour", 11).toDate(), source: "eventType-1-booking-1", title: "Booking Between X and Y", }), expect.objectContaining({ - start: new Date(`${tomorrowDate}T14:00:00.000Z`), - end: new Date(`${tomorrowDate}T15:00:00.000Z`), + start: dayjs(`${tomorrowDate}`).startOf("day").set("hour", 14).toDate(), + end: dayjs(`${tomorrowDate}`).startOf("day").set("hour", 15).toDate(), source: "eventType-1-booking-2", title: "Booking Between X and Y", }), @@ -98,8 +98,8 @@ describe("getBusyTimes", () => { }); expect(busyTimes).toEqual([ expect.objectContaining({ - start: new Date(`${tomorrowDate}T09:50:00.000Z`), - end: new Date(`${tomorrowDate}T11:00:00.000Z`), + start: dayjs(`${tomorrowDate}`).startOf("day").set("hour", 9).set("minute", 50).toDate(), + end: dayjs(`${tomorrowDate}`).startOf("day").set("hour", 11).toDate(), source: "eventType-1-booking-1", title: "Booking Between X and Y", }), @@ -120,8 +120,8 @@ describe("getBusyTimes", () => { }); expect(busyTimes).toEqual([ expect.objectContaining({ - start: new Date(`${tomorrowDate}T09:50:00.000Z`), - end: new Date(`${tomorrowDate}T10:00:00.000Z`), + start: dayjs(`${tomorrowDate}`).startOf("day").set("hour", 9).set("minute", 50).toDate(), + end: dayjs(`${tomorrowDate}`).startOf("day").set("hour", 10).toDate(), }), ]); });