We've created a contact form that allows visitors to enter check-in and check-out dates using two datepickers. We'd therefore like the user to select a date on the 1st datepicker (check-in) and then display results on the 2nd datepicker (check-out) that are only after the date inserted on the 1st one.
Although right now the logic works and the date on 2nd datepicker is a later date of the one of the 1st datepicker, the 2nd datepicker by default focuses on the current month and not on the one relevant month to the user's input on the 1st datepicker.
The code used is the following:
import {processEnquiry, createEnquiry} from 'backend/enquirySubmitLogic';
$w.onReady(function () {
$w('#datePicker1').onChange(()=>{
let pickerMinDate = $w("#datePicker1").value;
pickerMinDate.setDate(pickerMinDate.getDate()+1)
$w("#datePicker2").minDate = pickerMinDate;
});
Thank you for following up. Got it to work!
You can set the "value" of the second datePicker to the same value as the "minDate" and it will open focused on that date.