0
votes

I have two datepickers one for startDate and other for endDate which are initially set to current.

Now when I change startDate I want the 1. endDate should have minDate as selected date and 2. maxDate will be 2 months from the selected.

Step 1 is working but I have problem with step2 . my current code looks like this:

$( "#from" ).datepicker({ defaultDate: "+1w", dateFormat: "yy-mm-dd", changeMonth: true, numberOfMonths: 3, onClose: function( selectedDate ) { $( "#to" ).datepicker( "option", "minDate", selectedDate ); $( "#to" ).datepicker( "option", "maxDate", "+2M" ); } }).datepicker("setDate", "0");

1

1 Answers

0
votes

Reading the documentation, you are actually setting the maxDate options 2 months from today:

String: Relative dates must contain value and period pairs; valid periods are "y" for years, "m" for months, "w" for weeks, and "d" for days. For example, "+1m +7d" represents one month and seven days from today.