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:

Websites designed by WixCreate that use the above Wix Code:

None

Official Wix Expert & Wix Agency Partner

© 2020 by WIXCreate.com

I  All Rights Reserved  I  info@wixcreate.com  I  202-640-5440

facebook-2.gif