JQuery datePicker: start/end date should be within one year
Posted
by Abu Hamzah
on Stack Overflow
See other posts from Stack Overflow
or by Abu Hamzah
Published on 2010-04-23T02:08:05Z
Indexed on
2010/04/23
2:23 UTC
Read the original article
Hit count: 492
So if my start date is : 04/22/2010
then my end date selection can be up to 04/22/2011
and after 04/22/2011
are dates all disabled.
Here is what I have for both selection start and end date:
$(document).ready(function () {
$('#endDate').datepicker({ showOn: 'button',
buttonImage: '../images/Calendar.png',
buttonImageOnly: true, onSelect: function () { },
onClose: function () { $(this).focus(); }
});
$('#startDate').datepicker({ showOn: 'button',
buttonImage: '../images/Calendar.png',
buttonImageOnly: true, onSelect:
function (dateText, inst) {
$('#endDate').datepicker("option", 'minDate', new Date(dateText));
}
,
onClose: function () { $(this).focus(); }
});
});
© Stack Overflow or respective owner