Fixing DST issues for recurring reservations
This commit is contained in:
parent
11dc49e865
commit
7d6b45032b
2 changed files with 4 additions and 4 deletions
|
|
@ -36,7 +36,7 @@ const dayjsTz = (
|
||||||
date?: string | number | Date | dayjs.Dayjs | null | undefined,
|
date?: string | number | Date | dayjs.Dayjs | null | undefined,
|
||||||
format?: string,
|
format?: string,
|
||||||
) => {
|
) => {
|
||||||
return dayjs(date, format).tz()
|
return dayjs(date, format).tz('Europe/Amsterdam')
|
||||||
}
|
}
|
||||||
|
|
||||||
export default dayjsTz
|
export default dayjsTz
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ describe('recurringReservations.entity', () => {
|
||||||
dayOfWeek: 2,
|
dayOfWeek: 2,
|
||||||
})
|
})
|
||||||
const reservation = rr.createReservationInAdvance(7)
|
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 () => {
|
it('should create reservation at same time in 7 days (DST --> NDST)', async () => {
|
||||||
|
|
@ -24,7 +24,7 @@ describe('recurringReservations.entity', () => {
|
||||||
dayOfWeek: 4,
|
dayOfWeek: 4,
|
||||||
})
|
})
|
||||||
const reservation = rr.createReservationInAdvance(7)
|
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 () => {
|
it('should create reservation at same time in 7 days (NDST --> DST)', async () => {
|
||||||
|
|
@ -36,7 +36,7 @@ describe('recurringReservations.entity', () => {
|
||||||
dayOfWeek: 4,
|
dayOfWeek: 4,
|
||||||
})
|
})
|
||||||
const reservation = rr.createReservationInAdvance(7)
|
const reservation = rr.createReservationInAdvance(7)
|
||||||
expect(reservation.dateRangeStart).toEqual(dayjs('2024-10-31T18:30'))
|
expect(reservation.dateRangeStart).toEqual(dayjs('2024-10-31T17:30Z'))
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue