added on more condition checIn and checkOut are present, and same day, so display slots from chekout to end of that day.

This commit is contained in:
Pramod Mahajan 2025-05-02 14:25:10 +05:30
parent cb2950338c
commit 8e04dd2191

View File

@ -69,8 +69,10 @@ const TimePicker = ({ label, onChange, interval = 10, value,checkInTime, checkOu
}
} else if (checkInDate && checkOutDate) {
// Case 3: Both check-in and checkout present
const isSameDay = new Date(checkOutDate).toDateString() === new Date().toDateString();
minSelectable = new Date(checkOutDate);
maxSelectable = new Date(currentSlot);
maxSelectable = isSameDay ? new Date(dayEnd) : new Date(currentSlot);
}
const slot = new Date(dayStart.getTime());