From 7d6b45032b24f2e73b8a9b81843f3fd430193cc9 Mon Sep 17 00:00:00 2001 From: Collin Duncan <3679940+cgduncan7@users.noreply.github.com> Date: Thu, 28 Mar 2024 18:02:33 +0100 Subject: [PATCH] Fixing DST issues for recurring reservations --- src/common/dayjs.ts | 2 +- test/unit/recurringReservations/entity.spec.ts | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/common/dayjs.ts b/src/common/dayjs.ts index 633b72c..cbfa30a 100644 --- a/src/common/dayjs.ts +++ b/src/common/dayjs.ts @@ -36,7 +36,7 @@ const dayjsTz = ( date?: string | number | Date | dayjs.Dayjs | null | undefined, format?: string, ) => { - return dayjs(date, format).tz() + return dayjs(date, format).tz('Europe/Amsterdam') } export default dayjsTz diff --git a/test/unit/recurringReservations/entity.spec.ts b/test/unit/recurringReservations/entity.spec.ts index f7750dc..c3d2c74 100644 --- a/test/unit/recurringReservations/entity.spec.ts +++ b/test/unit/recurringReservations/entity.spec.ts @@ -12,7 +12,7 @@ describe('recurringReservations.entity', () => { dayOfWeek: 2, }) const reservation = rr.createReservationInAdvance(7) - expect(reservation.dateRangeStart).toEqual(dayjs('2024-01-09T18:30')) + expect(reservation.dateRangeStart).toEqual(dayjs('2024-01-09T17:30Z')) }) it('should create reservation at same time in 7 days (DST --> NDST)', async () => { @@ -24,7 +24,7 @@ describe('recurringReservations.entity', () => { dayOfWeek: 4, }) const reservation = rr.createReservationInAdvance(7) - expect(reservation.dateRangeStart).toEqual(dayjs('2024-04-04T18:30')) + expect(reservation.dateRangeStart).toEqual(dayjs('2024-04-04T16:30Z')) }) it('should create reservation at same time in 7 days (NDST --> DST)', async () => { @@ -36,7 +36,7 @@ describe('recurringReservations.entity', () => { dayOfWeek: 4, }) const reservation = rr.createReservationInAdvance(7) - expect(reservation.dateRangeStart).toEqual(dayjs('2024-10-31T18:30')) + expect(reservation.dateRangeStart).toEqual(dayjs('2024-10-31T17:30Z')) }) }) })