[jQuery] set the gap of start and end date in datepicker
Hi
I have simple problem in which I want to set the difference of 2 dates
max 60 days.
I am able to select dates from past in 2 textboxes and I want when
user select start date , the end date calender should disable
everything after 60 days..
here is the code I am using:
Date.format = 'mm/dd/yyyy';
//this function is used to show only past dates in calendar.
$('.date-pick').datePicker(
{
startDate: '01/01/2000',
endDate: (new Date()).asString()
}
);
//this function is used to set end date after start date
$('.date-pick').datePicker()
$('#' + serverIdPrefix + 'TextBox1').bind(
'dpClosed',
function(e, selectedDates) {
var d = selectedDates[0];
if (d) {
d = new Date(d);
$('#' + serverIdPrefix + 'TextBox2').dpSetStartDate(d.addDays
(1).asString());
}
}
);
$('#' + serverIdPrefix + 'TextBox2').bind(
'dpClosed',
function(e, selectedDates) {
var d = selectedDates[0];
if (d) {
d = new Date(d);
$('#' + serverIdPrefix + 'TextBox1').dpSetEndDate(d.addDays
(-1).asString());
}
}
);
Please point me , if I can put a simple filter inside this where it
should not allow end date more then 60 days from start date..
Thanks
Varun