Take a look at my answer here - JQuery datepicker- 2 inputs/textboxes and restricting range
One way to do it would be to use the beforeShow
property to restrict value in the second datepicker. Alternatively, define an onSelect
handler that updates the second input when a date is chosen in the first.
Working Demo Note: this is based on the jQuery DatePicker and not Keith Woods'.
EDIT:
As stated on the datepick plugin page -
This plugin forms the basis for the
jQuery UI Datepicker. It is made
available as a separate plugin since
the UI team desired simplified
functionality for their version.
thus the code based on the jQuery UI Datepicker will work with Keith's datepicker.
Code from demo
$(function ()
{
$('#txtStartDate, #txtEndDate').datepicker(
{
showOn: "both",
dateFormat: "dd M yy",
onSelect: insertOtherDate,
firstDay: 1,
changeFirstDay: false
});
});
function insertOtherDate(value, date, inst) {
var firstDate = new Date(value);
var datepickerInput = (date.id === 'txtStartDate') ? 'txtEndDate' : 'txtStartDate';
var dateAdjust = (date.id === 'txtStartDate') ? 1 : -1;
var secondDate = new Date(firstDate.getFullYear(), firstDate.getMonth(), firstDate.getDate() + dateAdjust);
$('#' + datepickerInput).datepicker('setDate', secondDate);
}