From 99260974f48e8b900e606a0775f1ce6760d010dc Mon Sep 17 00:00:00 2001 From: Anik Dhabal Babu <81948346+anikdhabal@users.noreply.github.com> Date: Tue, 18 Feb 2025 18:46:46 +0530 Subject: [PATCH] fix: Issues with date changes in column view (#19258) * fix: coulmn view date change * Update store.ts --------- Co-authored-by: Udit Takkar <53316345+Udit-takkar@users.noreply.github.com> --- packages/features/bookings/Booker/store.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/features/bookings/Booker/store.ts b/packages/features/bookings/Booker/store.ts index 2ed4f11651..331217cecc 100644 --- a/packages/features/bookings/Booker/store.ts +++ b/packages/features/bookings/Booker/store.ts @@ -210,7 +210,13 @@ export const useBookerStore = create((set, get) => ({ }, addToSelectedDate: (days: number) => { const currentSelection = dayjs(get().selectedDate); - const newSelection = currentSelection.add(days, "day"); + let newSelection = currentSelection.add(days, "day"); + + // If newSelection is before the current date, set it to today + if (newSelection.isBefore(dayjs(), "day")) { + newSelection = dayjs(); + } + const newSelectionFormatted = newSelection.format("YYYY-MM-DD"); if (newSelection.month() !== currentSelection.month()) {