Skip to content

Scheduling infrastructure for absolutely everyone.

fix: Ensure correct fallback to current month when 'month' query param is missing (#18097)

Sanchit Tewari9a8ec4d281f8
diff --git a/packages/features/bookings/Booker/store.ts b/packages/features/bookings/Booker/store.ts
index 8e0e8febb15..70108203fff 100644
--- a/packages/features/bookings/Booker/store.ts
+++ b/packages/features/bookings/Booker/store.ts
@@ -225,7 +225,12 @@ export const useBookerStore = create<BookerStore>((set, get) => ({
setVerifiedEmail: (email: string | null) => {
set({ verifiedEmail: email });
},
- month: getQueryParam("month") || getQueryParam("date") || dayjs().format("YYYY-MM"),
+ month:
+ getQueryParam("month") ||
+ (getQueryParam("date") && dayjs(getQueryParam("date")).isValid()
+ ? dayjs(getQueryParam("date")).format("YYYY-MM")
+ : null) ||
+ dayjs().format("YYYY-MM"),
setMonth: (month: string | null) => {
if (!month) {
removeQueryParam("month");