Small tweak to handle swapped dates

This commit is contained in:
2024-05-17 20:56:18 -04:00
parent adc34a116b
commit c3ee739366

View File

@@ -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');