From f2b81b8c7abd08df9471b5e22d80bb28d4b6f6f6 Mon Sep 17 00:00:00 2001 From: Linus Flood Date: Tue, 1 Jul 2025 12:57:57 +0000 Subject: [PATCH] Merged in feat/sw-3134-daypicker (pull request #2495) feat(SW-3134): Fix first day of month disabled * feat(SW-3134): Fix first day of month disabled * Fixed single daypicker Approved-by: Bianca Widstam --- apps/scandic-web/components/DatePicker/Range/Desktop.tsx | 3 +-- apps/scandic-web/components/DatePicker/Range/Mobile.tsx | 3 +-- apps/scandic-web/components/DatePicker/Single/Desktop.tsx | 3 +-- apps/scandic-web/components/DatePicker/Single/Mobile.tsx | 3 +-- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/apps/scandic-web/components/DatePicker/Range/Desktop.tsx b/apps/scandic-web/components/DatePicker/Range/Desktop.tsx index cf792fa86..8c71945b2 100644 --- a/apps/scandic-web/components/DatePicker/Range/Desktop.tsx +++ b/apps/scandic-web/components/DatePicker/Range/Desktop.tsx @@ -33,7 +33,6 @@ export default function DatePickerRangeDesktop({ /** English is default language and doesn't need to be imported */ const locale = lang === Lang.en ? undefined : locales[lang] const currentDate = dt().toDate() - const startOfMonth = dt(currentDate).set("date", 1).toDate() const yesterday = dt(currentDate).subtract(1, "day").toDate() // Max future date allowed to book kept same as of existing prod. @@ -64,7 +63,7 @@ export default function DatePickerRangeDesktop({ button_previous: `${classNames.button_previous} ${styles.button_previous}`, }} disabled={[ - { from: startOfMonth, to: yesterday }, + { from: undefined, to: yesterday }, { from: endDate, to: endOfLastMonth }, ]} excludeDisabled diff --git a/apps/scandic-web/components/DatePicker/Range/Mobile.tsx b/apps/scandic-web/components/DatePicker/Range/Mobile.tsx index 208a1a7a5..e32f60394 100644 --- a/apps/scandic-web/components/DatePicker/Range/Mobile.tsx +++ b/apps/scandic-web/components/DatePicker/Range/Mobile.tsx @@ -33,7 +33,6 @@ export default function DatePickerRangeMobile({ const [autoScrollEnabled, setAutoScrollEnabled] = useState(true) const currentDate = dt().toDate() - const startOfCurrentMonth = dt(currentDate).set("date", 1).toDate() const yesterday = dt(currentDate).subtract(1, "day").toDate() useEffect(() => { if (!monthsRef.current || !selectedRange?.from || !autoScrollEnabled) return @@ -84,7 +83,7 @@ export default function DatePickerRangeMobile({ weekday: `${classNames.weekday} ${styles.weekDay}`, }} disabled={[ - { from: startOfCurrentMonth, to: yesterday }, + { from: undefined, to: yesterday }, { from: endDate, to: endOfLastMonth }, ]} endMonth={endDate} diff --git a/apps/scandic-web/components/DatePicker/Single/Desktop.tsx b/apps/scandic-web/components/DatePicker/Single/Desktop.tsx index 3030d94c9..417b4f68b 100644 --- a/apps/scandic-web/components/DatePicker/Single/Desktop.tsx +++ b/apps/scandic-web/components/DatePicker/Single/Desktop.tsx @@ -34,7 +34,6 @@ export default function DatePickerSingleDesktop({ /** English is default language and doesn't need to be imported */ const locale = lang === Lang.en ? undefined : locales[lang] const currentDate = dt().toDate() - const startOfMonth = dt(currentDate).set("date", 1).toDate() const yesterday = dt(currentDate).subtract(1, "day").toDate() // Max future date allowed to book kept same as of existing prod. @@ -66,7 +65,7 @@ export default function DatePickerSingleDesktop({ button_previous: `${classNames.button_previous} ${styles.button_previous}`, }} disabled={[ - { from: startOfMonth, to: yesterday }, + { from: undefined, to: yesterday }, { from: endDate, to: endOfLastMonth }, ]} footer diff --git a/apps/scandic-web/components/DatePicker/Single/Mobile.tsx b/apps/scandic-web/components/DatePicker/Single/Mobile.tsx index 0e52de12f..368286c85 100644 --- a/apps/scandic-web/components/DatePicker/Single/Mobile.tsx +++ b/apps/scandic-web/components/DatePicker/Single/Mobile.tsx @@ -29,7 +29,6 @@ export default function DatePickerSingleMobile({ /** English is default language and doesn't need to be imported */ const locale = lang === Lang.en ? undefined : locales[lang] const currentDate = dt().toDate() - const startOfCurrentMonth = dt(currentDate).set("date", 1).toDate() const yesterday = dt(currentDate).subtract(1, "day").toDate() // Max future date allowed to book kept same as of existing prod. @@ -52,7 +51,7 @@ export default function DatePickerSingleMobile({ weekday: `${classNames.weekday} ${styles.weekDay}`, }} disabled={[ - { from: startOfCurrentMonth, to: yesterday }, + { from: undefined, to: yesterday }, { from: endDate, to: endOfLastMonth }, ]} endMonth={endDate}