fix: confirm booking doesn't respect minimum booking notice (#14577)

Signed-off-by: Abhiuday <[email protected]>
This commit is contained in:
Abhiuday Gupta authored and GitHub committed 2024-04-26 11:58:11 -04:00
1 parent ab26481738
commit fc16ec59d3
2 files changed
+30 -12

No files matched your search

+9 -1
View File
@@ -28,13 +28,21 @@ function isOutOfBounds(
}: Pick<
EventType,
"periodType" | "periodDays" | "periodCountCalendarDays" | "periodStartDate" | "periodEndDate"
>
>,
minimumBookingNotice?: number
) {
const date = dayjs(time);
guardAgainstBookingInThePast(date.toDate());
periodDays = periodDays || 0;
if (minimumBookingNotice) {
const minimumBookingStartDate = dayjs().add(minimumBookingNotice, "minutes");
if (date.isBefore(minimumBookingStartDate)) {
return true;
}
}
switch (periodType) {
case PeriodType.ROLLING: {
const periodRollingEndDay = periodCountCalendarDays