【发布时间】:2019-10-24 06:50:36
【问题描述】:
我可以让今天的日期出现在入住日期,但问题是用户仍然可以选择今天之前的日期。有什么解决方案可以让我解决他的问题吗?任何建议都会有很大帮助,谢谢!
$(function () {
$("#chkI").datepicker({
dateFormat: "yy-mm-dd", showAnim: "slideDown",
onClose: function (selectedDate) {
var minDate = $(this).datepicker('getDate');
var newMin = new Date(minDate.setDate(minDate.getDate() + 1));
$("#chkO").datepicker("option", "minDate", newMin);
}
});
var currentDate = new Date();
$("#chkI").datepicker("setDate", currentDate);
$("#chkO").datepicker({ dateFormat: "yy-mm-dd", showAnim: "slideDown",
onClose: function (selectedDate) {
var maxDate = $(this).datepicker('getDate');
var newMax = new Date(maxDate.setDate(maxDate.getDate() - 1));
$("#chkI").datepicker("option", "maxDate", newMax);
}
});
});
【问题讨论】:
标签: javascript jquery date jquery-ui-datepicker