单击下一个(或上一个)月份时,我想获取日期选择器的第一个显示日期。日期选择器显示 2 个月(例如 11 月和 12 月),当我单击下个月时,我想触发一个函数,其中第一个日期作为变量,如下所示:
$(document).on('click','.ui-datepicker-next',function(){
test(first_date);
});
$(function() {
$( "#vak_kalender" ).datepicker({
numberOfMonths: 2,
minDate: new Date(),
maxDate: new Date(volgend_jaar, 24,0),
beforeShowDay:function highlightDays(date) {
var timestamp = new Date(Date.UTC(date.getFullYear(),date.getMonth(),date.getDate()));
var timestamp = timestamp/1000;
if ($.inArray(timestamp, verhuurt) != -1){
return [false,'verhuurt'];
}
else if ($.inArray(timestamp, gesloten) != -1) {
return [false,'gesloten'];
}
else if ($.inArray(timestamp, wisseldagen) != -1) {
return [true,'wisseldag'];
}
else{return [true, 'beschikbaar'];}
},
showWeek: true
});
});