I am using datepicker as follows:
$(".datepicker").datepicker({
monthNames: datepickerResources.monthNames,
dayNames: datepickerResources.dayNames,
dayNamesShort: datepickerResources.dayNamesShort,
dayNamesMin: datepickerResources.dayNamesMin,
minDate: 0,
maxDate: "+4w -1d",
numberOfMonths: [12, 1],
beforeShowDay: function (date) {
var date1 = $.datepicker.parseDate($.datepicker._defaults.dateFormat, $("#input1").val());
var date2 = $.datepicker.parseDate($.datepicker._defaults.dateFormat, $("#input2").val());
return [true, SetDateColor(date, date1, date2)];
},
onSelect: function (dateText, inst) {
var date1 = $.datepicker.parseDate($.datepicker._defaults.dateFormat, $("#input1").val());
var date2 = $.datepicker.parseDate($.datepicker._defaults.dateFormat, $("#input2").val());
if (!date1 || date2) {
$("#input1").val(dateText);
$("#input2").val("");
$(this).datepicker();
} else {
$("#input2").val(dateText);
$(this).datepicker();
}
}
});
After I define the maxDate, the prev and the next button stop working and are in disable although there are active days also on the next month. Thanks for the help
You display 12 months simultaneously: numberOfMonths: [12, 1],
.
maxDate
property sets the maximum allowed date from now plus 4 weeks minus 1 day. minDate
property limits the oldest date by current date. With such limits the possible date range is from now
to now + 4 weeks - 1 day
. The full range is already shown, so it is not possible to press the next
or prev
buttons.
If you set to show only one month ( numberOfMonths: 1,
) it is possible to go to the next page with such range.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.