From c3ee739366784c39c6add6f57d5f886b30e230a0 Mon Sep 17 00:00:00 2001 From: Patrick Toal Date: Fri, 17 May 2024 20:56:18 -0400 Subject: [PATCH] Small tweak to handle swapped dates --- src/stores/reservation.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/stores/reservation.ts b/src/stores/reservation.ts index d6021b8..22d49b3 100644 --- a/src/stores/reservation.ts +++ b/src/stores/reservation.ts @@ -16,8 +16,9 @@ export const useReservationStore = defineStore('reservation', () => { start: string = today(), end: string = start ) => { - const startDate = new Date(start + 'T00:00'); - const endDate = new Date(end + 'T23:59'); + const startDate = new Date(start < end ? start : end + 'T00:00'); + const endDate = new Date(start < end ? end : start + 'T23:59'); + if (getUnloadedDates(startDate, endDate).length === 0) return; setDateLoaded(startDate, endDate, 'pending');