Skip to content

Commit

Permalink
Fix to overnight calendar is next blocked check (#331)
Browse files Browse the repository at this point in the history
Previously when user selected a date after a blocked date as start date and then selected a new start date on a date where start date is not allowed (i.e. next day is blocked) the check would allow this. This change fixes the issue.
  • Loading branch information
SanttuA authored May 31, 2024
1 parent a9799cd commit 065b842
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/shared/overnight-calendar/OvernightCalendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,9 @@ function OvernightCalendar({
});

const validateAndSelect = (day, { booked, nextBooked, nextClosed }) => {
const isNextBlocked = (!startDate || (startDate && endDate)) && (nextBooked || nextClosed);
const isNextBlocked = (
!startDate || (startDate && endDate) || moment(day).isBefore(startDate)
) && (nextBooked || nextClosed);
const isDateDisabled = handleDisableDays({
day,
now,
Expand Down

0 comments on commit 065b842

Please sign in to comment.