当您为开始日期选择任何内容时,结束日期应自动与在 jQuery 中单击时的开始日期相同
var dates = $("#filterDateStart, #filterDateEnd").datepicker({
dateFormat: "yy-mm-dd",
changeMonth: true,
numberOfMonths: 1,
onSelect: function (selectedDate) {
var option = this.id == "filterDateStart" ? "minDate" : "maxDate",
instance = $(this).data("datepicker"),
date = $.datepicker.parseDate(
instance.settings.dateFormat ||
$.datepicker._defaults.dateFormat,
selectedDate, instance.settings);
dates.not(this).datepicker("option", option, date);
}
});
var dates1 = $("#filterDateStart1, #filterDateEnd1").datepicker({
dateFormat: "yy-mm-dd",
changeMonth: true,
numberOfMonths: 1,
onSelect: function (selectedDate) {
var option = this.id == "filterDateStart1" ? "minDate" : "maxDate",
instance = $(this).data("datepicker"),
date = $.datepicker.parseDate(
instance.settings.dateFormat ||
$.datepicker._defaults.dateFormat,
selectedDate, instance.settings);
dates1.not(this).datepicker("option", option, date);
}
});