Question:
I have a DatePicker element in my page where users can select a delivery date. I set the minDate dynamically with the following code:
function setMinDate() {
const now = new Date();
const curDay = now.getDay();
const minDate = moment(now);
if (curDay === THURSDAY) {
minDate.add(THURSDAY_BLOCK_DAYS, 'days')
} else {
const curHour = now.getHours();
const cutoff = curHour >= CUTOFF_HOUR;
const daysToAdd = cutoff ? WEEKDAY_BLOCK_DAYS + 1 : WEEKDAY_BLOCK_DAYS;
minDate.add(daysToAdd, 'days');
}
$w('#deliveryDatePicker').minDate = minDate.toDate();
}
Product:
Wix Editor
It started breaking a few days ago, with two issues:
- The minimum date doesn’t seem to work - I can still choose days that are before the minimum date. They seem “disabled”, but you can click them.
- The calendar shows past dates even though “Show past dates” is turned off.
You can see in the following example, the logged minimum date is 30 March:
Datepicker minimum date is Sun Mar 30 2025
However, I can still see and choose dates that are before that.