I am working with jquery multidatespicker where I have to define a range of dates to be allowed after the first date has been picked.
我正在使用jquery multidatespicker,我必须在第一个日期被选中后定义一系列日期。
I need to exclude the weekends from all the future dates. However, pickableRange doesn't skip the weekends that are disabled with beforeShowDay.
我需要排除所有未来日期的周末。但是,pickableRange不会跳过使用beforeShowDay禁用的周末。
I also tried adding addDisabledDates but it is not feasible to add all the weekend dates in an array.
我也尝试添加addDisabledDates但是在数组中添加所有周末日期是不可行的。
This is the code that I have been trying.
这是我一直在尝试的代码。
$('#id').multiDatesPicker({
pickableRange: 15,
adjustRangeToDisabled: true,
beforeShowDay: $.datepicker.noWeekends,
addDisabledDates : ['array containing all weekends and holidays'] // not feasible option
})
Kindly help me out here..
请帮帮我..
1 个解决方案
#1
5
$('#id').multiDatesPicker({
beforeShowDay: disableSpecificWeekDays,
// For disabling all "Sundays and saturday"
dateFormat: "d/m/yy",
maxDate: "+3m",
minDate: "-1m",
multidate: true,
});
function disableSpecificWeekDays(date) {
var theday = date.getDate() + '/' +
(date.getMonth() + 1) + '/' +date.getFullYear();
var day = date.getDay();
return [day != 0 && day != 6];
}
Here we can assign a method for disabling a weekend. please try this.
在这里,我们可以指定一种禁用周末的方法。请试试这个。
#1
5
$('#id').multiDatesPicker({
beforeShowDay: disableSpecificWeekDays,
// For disabling all "Sundays and saturday"
dateFormat: "d/m/yy",
maxDate: "+3m",
minDate: "-1m",
multidate: true,
});
function disableSpecificWeekDays(date) {
var theday = date.getDate() + '/' +
(date.getMonth() + 1) + '/' +date.getFullYear();
var day = date.getDay();
return [day != 0 && day != 6];
}
Here we can assign a method for disabling a weekend. please try this.
在这里,我们可以指定一种禁用周末的方法。请试试这个。