top of page
Anchor 1

Wix Tutorial - Pass dates between two datepickers.

Pass dates from one Wix Datepicker to another. By using that information, a minimum date will be set for the second datepicker. 

Elements:

User Input:

  • datepicker for start date: #datePicker1

  • datepicker for end date: #datePicker2

Wix Code:

$w.onReady(function () {

 $w("#datePicker1").onChange((event) => {

     console.log(event.target.value);

     let newdate = new Date(event.target.value);

newdate.setDate(newdate.getDate() + 1);

     $w("#datePicker2").value = newdate;

     $w("#datePicker2").minDate = newdate;

 });

});

Demo:

Start Date:

End Date:

Wix Code Pass Dates between Two Datepick
bottom of page