我希望每次选择新日期时都能动态设置minDate和maxDate
$("#dtpik1").datepicker({
minDate: "-3M",
maxDate: '0D',
dateFormat: "dd/mm/yy",
onSelect: function(selected, date, value) {
var d = new Date()
var d1 = d.getDate()
var date2 = $("#dtpik1").datepicker("getDate")
date2.setDate(date2.getDate() + 30)
var date3 = $("#dtpik1").datepicker("getDate")
if (d > date2) {
$('#dtpik2').datepicker({
dateFormat: "dd/mm/yy",
changeMonth: true,
changeYear: true,
minDate: '-4M' && date3,
maxDate: date2
});
$('#dtpik2').datepicker('setDate', date2);
} else {
$('#dtpik2').datepicker({
dateFormat: "dd/mm/yy",
changeMonth: true,
changeYear: true,
minDate: '-4M' && date3,
maxDate: d
});
$('#dtpik2').datepicker('setDate', d);
}
},
});