I use a 2nd code so that the date selected in DatePicker1 is the minimum date that can be selected in DatePicker2:
export function datePicker1_change(event) {
let firstTime = event.target.value.getTime();
let timeTwoDaysHence = firstTime + (1 * 86400000) ;
let dateTwoDaysHence = new Date(timeTwoDaysHence) ;
$w(‘#datePicker2’).minDate = dateTwoDaysHence ;
Now I would like the maximum selectable date in DatePicker2 to be the first deactivated date after the selected date in datePicker1. I hope to have been clear…
Is it possible to maxDate?
I have tried a multitude of formulas but cannot do it … can someone help me?
@caromagagna I can’t tell at first glance. Try to add console.log 's after each row and see where the error is.
But I think that in line 2 (refers to your last comment) you should use new Date().
Maybe something like:
let firstTime = new Date($w('#datePicker1').value).getTime();
It still does not work.
By indicating disabledDateRange from the beginning, the disabled dates are no longer grayed out, the code no longer works at all.
To better understand, and if you want to watch, I enclose the link of my site (« réserver » page, disabled dates are August 11 and 12) : https://casachill.wixsite.com/locationbarcares
I have also just noticed that the price calculation is not done online (it displays Nan) while it works in “preview” mode. I do not understand anything anymore ! I will create another post about this.