From ef6618743d5c1367fadf7b98cf15f7ba829535e3 Mon Sep 17 00:00:00 2001 From: "devin-ai-integration[bot]" <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Thu, 31 Jul 2025 10:25:11 +0000 Subject: [PATCH] feat: add optional startTime prop to BookerPlatformWrapper (#22731) * feat: add optional startTime prop to BookerPlatformWrapper - Add startTime prop to BookerPlatformWrapperAtomProps interface - Allow users to override calculated startTime from useTimesForSchedule - Maintain backward compatibility when prop is not provided - Add JSDoc documentation for proper usage Co-Authored-By: somay@cal.com * feat: add custom start time support to Booker component with date object input * feat: update documentation and added changelog --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: somay@cal.com Co-authored-by: Somay Chauhan --- .changeset/dull-carpets-help.md | 5 +++++ docs/platform/atoms/booker.mdx | 1 + packages/platform/atoms/booker/BookerPlatformWrapper.tsx | 9 ++++++++- packages/platform/atoms/booker/types.ts | 1 + 4 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 .changeset/dull-carpets-help.md diff --git a/.changeset/dull-carpets-help.md b/.changeset/dull-carpets-help.md new file mode 100644 index 0000000000..1227871c66 --- /dev/null +++ b/.changeset/dull-carpets-help.md @@ -0,0 +1,5 @@ +--- +"@calcom/atoms": patch +--- + +Added new startTime prop to the Booker component that allows users to decide the first available date when the booker loads diff --git a/docs/platform/atoms/booker.mdx b/docs/platform/atoms/booker.mdx index 75962bced9..0a980ec1bf 100644 --- a/docs/platform/atoms/booker.mdx +++ b/docs/platform/atoms/booker.mdx @@ -90,6 +90,7 @@ Below is a list of props that can be passed to the booker atom. | customClassNames | No | To pass in custom classnames from outside for styling the atom | | month | No | The exact month for displaying a user's availability; defaults to the current month | | selectedDate | No | Default selected date for which the slot picker opens | +| startTime | No | Custom start time for the Booker that allows users to decide the first available date. Accepts JavaScript Date object or date string in format `YYYY-MM-DD` (e.g., `"2025-08-20"` or `new Date("2025-08-20")`) | | hideBranding | No | For hiding any branding on the booker | | isAway | No | Sets the booker component to the away state | | allowsDynamicBooking | No | Boolean indicating if the booking is a dynamic booking | diff --git a/packages/platform/atoms/booker/BookerPlatformWrapper.tsx b/packages/platform/atoms/booker/BookerPlatformWrapper.tsx index 38d06c8b6c..9de9a0d025 100644 --- a/packages/platform/atoms/booker/BookerPlatformWrapper.tsx +++ b/packages/platform/atoms/booker/BookerPlatformWrapper.tsx @@ -57,6 +57,7 @@ export const BookerPlatformWrapper = ( isBookingDryRun, handleSlotReservation, onTimeslotsLoaded, + startTime: customStartTime, } = props; const layout = BookerLayouts[view]; @@ -220,7 +221,7 @@ export const BookerPlatformWrapper = ( : undefined; const { timezone } = useTimePreferences(); - const [startTime, endTime] = useTimesForSchedule({ + const [calculatedStartTime, calculatedEndTime] = useTimesForSchedule({ month, monthCount, dayCount, @@ -228,6 +229,12 @@ export const BookerPlatformWrapper = ( selectedDate, }); + const startTime = + customStartTime && dayjs(customStartTime).isAfter(dayjs(calculatedStartTime)) + ? dayjs(customStartTime).toISOString() + : calculatedStartTime; + const endTime = calculatedEndTime; + const [routingParams, setRoutingParams] = useState<{ routedTeamMemberIds?: number[]; _shouldServeCache?: boolean; diff --git a/packages/platform/atoms/booker/types.ts b/packages/platform/atoms/booker/types.ts index 574214fcc1..e10542fd89 100644 --- a/packages/platform/atoms/booker/types.ts +++ b/packages/platform/atoms/booker/types.ts @@ -83,6 +83,7 @@ export type BookerPlatformWrapperAtomProps = Omit< isBookingDryRun?: boolean; eventMetaChildren?: React.ReactNode; onTimeslotsLoaded?: (slots: Record) => void; + startTime?: string | Date; }; type VIEW_TYPE = keyof typeof BookerLayouts;