I have made a jQuery UI Datepicker script as below to select only Weekends.
function onlyWeekends(date) {
var day = date.getDay();
return [(day == 0 || day == 6), ''];
}
$(function(){
// Datepicker
$('.datepicker').datepicker({
dateFormat: "dd-mm-yy",
beforeShowDay: onlyWeekends
});
});
But now I want to add one more restriction into this, which is, select date only up-to next 6 months from current date. How can I do that?
There are maxDate and minDate options available when configuring a .datepicker() object. See here in the fine manual.
But basically: