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 <iamamrit27@gmail.com>
This commit is contained in:
Sanchit Tewariandamrit authored and GitHub committed 2025-02-04 20:33:13 +05:30
1 parent 259624d44d
commit 9a8ec4d281
1 file changed
+6 -1
+6 -1
View File
@@ -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");