我有两个jquery日期选择器。
<input type="text" id="DateOption1_Common" asp-for="DateOption1" class="form-control form-control-sm form-control-br date-pick" value="" placeholder="mm/dd/yyyy">
<div id="appointDP" class="datepicker" asp-for="@Model.AppointmentDate"></div>
下面是我的脚本
if (Option >= 0) {
var offDays = ($('#CalenderSettings').val()).split(',');
var countryLocale = $("#countryLocale").val();
$("#appointDP").datepicker(Object.assign(setLocaleDateFormat(countryLocale), {
showWeek: true,
firstDay: 1,
defaultDate: selectedDate,
minDate: dateToday,
onSelect: function (dateText) {
getSecondStepData(bookingOption, dateText);
},
beforeShowDay: function (date) {
var datestring = jQuery.datepicker.formatDate('yy-mm-dd', date);
return [offDays.indexOf(datestring) == -1]
},
onChangeMonthYear: function (year, month, widget) {
var date = month + '/1/' + year;
getSecondStepData(bookingOption, date);
}
}));
}
else {
var countryLocale = $("#countryLocale").val();
$("#DateOption1_Common").datepicker();
$("#DateOption1_Common").datepicker(Object.assign(setLocaleDateFormat(countryLocale), {
minDate: dateToday,
//changeMonth: true,
//changeYear: true,
onClose: function (selectedDate) {
$("#DateOption2_Common").datepicker("option", "minDate", new Date());
}
}));
$("#DateOption2_Common").datepicker();
$("#DateOption2_Common").datepicker(Object.assign(setLocaleDateFormat(countryLocale), {
minDate: dateToday,
onClose: function (selectedDate) {
$("#DateOption2_Common").datepicker("option", "minDate", new Date());
}
}));
}
两个日期选择器都具有自定义属性,但是当我选择一个时,请选择第二个。我没有按预期显示第二个日期选择器。如何达到预期的结果。