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:
@@ -33,7 +33,6 @@ export default function DatePickerRangeDesktop({
|
|||||||
/** English is default language and doesn't need to be imported */
|
/** English is default language and doesn't need to be imported */
|
||||||
const locale = lang === Lang.en ? undefined : locales[lang]
|
const locale = lang === Lang.en ? undefined : locales[lang]
|
||||||
const currentDate = dt().toDate()
|
const currentDate = dt().toDate()
|
||||||
const startOfMonth = dt(currentDate).set("date", 1).toDate()
|
|
||||||
const yesterday = dt(currentDate).subtract(1, "day").toDate()
|
const yesterday = dt(currentDate).subtract(1, "day").toDate()
|
||||||
|
|
||||||
// Max future date allowed to book kept same as of existing prod.
|
// 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}`,
|
button_previous: `${classNames.button_previous} ${styles.button_previous}`,
|
||||||
}}
|
}}
|
||||||
disabled={[
|
disabled={[
|
||||||
{ from: startOfMonth, to: yesterday },
|
{ from: undefined, to: yesterday },
|
||||||
{ from: endDate, to: endOfLastMonth },
|
{ from: endDate, to: endOfLastMonth },
|
||||||
]}
|
]}
|
||||||
excludeDisabled
|
excludeDisabled
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ export default function DatePickerRangeMobile({
|
|||||||
const [autoScrollEnabled, setAutoScrollEnabled] = useState(true)
|
const [autoScrollEnabled, setAutoScrollEnabled] = useState(true)
|
||||||
|
|
||||||
const currentDate = dt().toDate()
|
const currentDate = dt().toDate()
|
||||||
const startOfCurrentMonth = dt(currentDate).set("date", 1).toDate()
|
|
||||||
const yesterday = dt(currentDate).subtract(1, "day").toDate()
|
const yesterday = dt(currentDate).subtract(1, "day").toDate()
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!monthsRef.current || !selectedRange?.from || !autoScrollEnabled) return
|
if (!monthsRef.current || !selectedRange?.from || !autoScrollEnabled) return
|
||||||
@@ -84,7 +83,7 @@ export default function DatePickerRangeMobile({
|
|||||||
weekday: `${classNames.weekday} ${styles.weekDay}`,
|
weekday: `${classNames.weekday} ${styles.weekDay}`,
|
||||||
}}
|
}}
|
||||||
disabled={[
|
disabled={[
|
||||||
{ from: startOfCurrentMonth, to: yesterday },
|
{ from: undefined, to: yesterday },
|
||||||
{ from: endDate, to: endOfLastMonth },
|
{ from: endDate, to: endOfLastMonth },
|
||||||
]}
|
]}
|
||||||
endMonth={endDate}
|
endMonth={endDate}
|
||||||
|
|||||||
@@ -34,7 +34,6 @@ export default function DatePickerSingleDesktop({
|
|||||||
/** English is default language and doesn't need to be imported */
|
/** English is default language and doesn't need to be imported */
|
||||||
const locale = lang === Lang.en ? undefined : locales[lang]
|
const locale = lang === Lang.en ? undefined : locales[lang]
|
||||||
const currentDate = dt().toDate()
|
const currentDate = dt().toDate()
|
||||||
const startOfMonth = dt(currentDate).set("date", 1).toDate()
|
|
||||||
const yesterday = dt(currentDate).subtract(1, "day").toDate()
|
const yesterday = dt(currentDate).subtract(1, "day").toDate()
|
||||||
|
|
||||||
// Max future date allowed to book kept same as of existing prod.
|
// 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}`,
|
button_previous: `${classNames.button_previous} ${styles.button_previous}`,
|
||||||
}}
|
}}
|
||||||
disabled={[
|
disabled={[
|
||||||
{ from: startOfMonth, to: yesterday },
|
{ from: undefined, to: yesterday },
|
||||||
{ from: endDate, to: endOfLastMonth },
|
{ from: endDate, to: endOfLastMonth },
|
||||||
]}
|
]}
|
||||||
footer
|
footer
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ export default function DatePickerSingleMobile({
|
|||||||
/** English is default language and doesn't need to be imported */
|
/** English is default language and doesn't need to be imported */
|
||||||
const locale = lang === Lang.en ? undefined : locales[lang]
|
const locale = lang === Lang.en ? undefined : locales[lang]
|
||||||
const currentDate = dt().toDate()
|
const currentDate = dt().toDate()
|
||||||
const startOfCurrentMonth = dt(currentDate).set("date", 1).toDate()
|
|
||||||
const yesterday = dt(currentDate).subtract(1, "day").toDate()
|
const yesterday = dt(currentDate).subtract(1, "day").toDate()
|
||||||
|
|
||||||
// Max future date allowed to book kept same as of existing prod.
|
// 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}`,
|
weekday: `${classNames.weekday} ${styles.weekDay}`,
|
||||||
}}
|
}}
|
||||||
disabled={[
|
disabled={[
|
||||||
{ from: startOfCurrentMonth, to: yesterday },
|
{ from: undefined, to: yesterday },
|
||||||
{ from: endDate, to: endOfLastMonth },
|
{ from: endDate, to: endOfLastMonth },
|
||||||
]}
|
]}
|
||||||
endMonth={endDate}
|
endMonth={endDate}
|
||||||
|
|||||||
Reference in New Issue
Block a user