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:
ashutosh.nehete 2025-05-04 12:24:27 +05:30
parent 213ca4067e
commit f1e22e944e

View File

@ -76,8 +76,9 @@ const TimePicker = ({ label, onChange, interval = 10, value,checkInTime,checkOut
}
} 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());