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
This commit is contained in:
Linus Flood
2025-07-01 12:57:57 +00:00
parent 03b8d8eac6
commit f2b81b8c7a
4 changed files with 4 additions and 8 deletions

View File

@@ -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

View File

@@ -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}

View File

@@ -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

View File

@@ -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}