From 9a8ec4d281f810e499375614c45120c23a4f06de Mon Sep 17 00:00:00 2001 From: Sanchit Tewari <46245135+sanchitttt@users.noreply.github.com> Date: Tue, 4 Feb 2025 20:33:13 +0530 Subject: [PATCH] fix: Ensure correct fallback to current month when 'month' query param is missing (#18097) Updated the query parameter handling logic to properly format the 'date' param as 'YYYY-MM' in case month param is missing. This resolves an issue where previous slots were not appearing. Co-authored-by: amrit --- packages/features/bookings/Booker/store.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/features/bookings/Booker/store.ts b/packages/features/bookings/Booker/store.ts index 8e0e8febb1..70108203ff 100644 --- a/packages/features/bookings/Booker/store.ts +++ b/packages/features/bookings/Booker/store.ts @@ -225,7 +225,12 @@ export const useBookerStore = create((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");