I'm not sure if the following will be helpful, and I haven't tested it, but a variation of this should disable to-dates that are less than 7 days after the from date:
- $("#fromDate").datepicker({
- ...
- onSelect: function(dateText, inst) {
- // if dateText is actually text(?).. then,
- var dateTo = new Date(dateText);
- // otherwise use dateText instead of dateTo in..
- var earliestDate = new Date(dateTo.getDate() + 7);
- $('#toDate').datepicker('option', 'minDate', earliestDate);
- }
- });
I'm not sure (as noted in the code) if dateText is actually text or a Date object.
You can also set 'maxDate' in a similar way.