0
私はショッピングカートに納期の入力欄があります。私は週末と日曜祝祭日の一部の祝日を無効にしました。しかし、いくつかの無効な日付を有効にすることはできません。私は12月23日と24日を有効にしたい。jquery UI datepickerで無効な日付を有効にするにはどうすればいいですか?
マイコード
var disableddates = ["1-1-2017","1-2-2017","1-26-2017","3-13-2017","4-14-2017","4-15-2017","4-16-2017","4-17-2017","4-25-2017","6-12-2017","9-25-2017","11-27-2017","11-28-2017","12-25-2017","12-26-2017","1-1-2018","1-2-2018","1-3-2018","1-4-2018","1-5-2018","1-8-2018","1-9-2018","1-10-2018","1-11-2018","1-12-2018","1-26-2018","3-12-2018","3-30-2018","3-31-2018","4-1-2018","4-2-2018","4-25-2018","6-11-2018","11-6-2018","12-25-2018","12-26-2018"];
function DisableSpecificDates(date) {
var m = date.getMonth();
var d = date.getDate();
var y = date.getFullYear();
// First convert the date in to the mm-dd-yyyy format
// Take note that we will increment the month count by 1
var currentdate = (m + 1) + '-' + d + '-' + y ;
// We will now check if the date belongs to disableddates array
for (var i = 0; i < disableddates.length; i++) {
// Now check if the current date is in disabled dates array.
if ($.inArray(currentdate, disableddates) != -1) {
return [false];
}
}
// In case the date is not present in disabled array, we will now check if it is a weekend.
// We will use the noWeekends function
var weekenddate = $.datepicker.noWeekends(date);
return weekenddate;
}
$("#delivery-date").datepicker({
minDate: disablerange,
beforeShowDay: DisableSpecificDates,
dateFormat: "dd/mm/yy"
});
コードの表示はどうですか? –
いくつかの日付を無効にする方法を教えてください。あなたのコードを共有してください。 –
なぜ、ちょうど1分 – akshay