I am creating one control for date range. which have below requirements.
- Form and To should be till yesterday no future dates [able to achive]
Restrict maximum 3 months of different.
$("#from-datepicker").datepicker({ dateFormat: "dd-M-yy", maxDate: "-1d", onClose: function (selectedDate) { console.log(selectedDate); $("#to-datepicker").datepicker("option", "minDate", selectedDate); //$("#to-datepicker").datepicker("option", "maxDate", selectedDate); } }); $("#to-datepicker").datepicker({ dateFormat: "dd-M-yy", maxDate: "-1d", onClose: function (selectedDate) { $("#from-datepicker").datepicker("option", "maxDate", selectedDate); } });
Here is JSfiddle
See Question&Answers more detail:os