Skip to content

Scheduling infrastructure for absolutely everyone.

fix 'attempt booking in the past' error (#12597)

Carina Wollendorfer56050b994d59
diff --git a/packages/trpc/server/routers/viewer/slots/util.ts b/packages/trpc/server/routers/viewer/slots/util.ts
index fbd63249b1f..882a2281d04 100644
--- a/packages/trpc/server/routers/viewer/slots/util.ts
+++ b/packages/trpc/server/routers/viewer/slots/util.ts
@@ -292,7 +292,7 @@ export async function getAvailableSlots({ input, ctx }: GetScheduleOptions) {
}`
);
const getStartTime = (startTimeInput: string, timeZone?: string) => {
- const startTimeMin = dayjs.utc().add(eventType.minimumBookingNotice, "minutes");
+ const startTimeMin = dayjs.utc().add(eventType.minimumBookingNotice || 1, "minutes");
const startTime = timeZone === "Etc/GMT" ? dayjs.utc(startTimeInput) : dayjs(startTimeInput).tz(timeZone);
return startTimeMin.isAfter(startTime) ? startTimeMin.tz(timeZone) : startTime;