Javascript Jquery UI日期选择器显示其他禁用日期
我正在尝试为日期选择器显示其他禁用的日期。例如,我的最小日期为Javascript Jquery UI日期选择器显示其他禁用日期,javascript,jquery-ui-datepicker,Javascript,Jquery Ui Datepicker,我正在尝试为日期选择器显示其他禁用的日期。例如,我的最小日期为2-1-2018,最大日期为3-1-2018。是否有任何方式将1-1-2018和4-1-2018显示为禁用?这是我现在拥有的。我不需要动态设置日期。我需要显示其他禁用日期,以便用户可以看到更大范围的禁用日期 beforeShow : function () { if (attrs.selecteddate) { /*
2-1-2018
,最大日期为3-1-2018
。是否有任何方式将1-1-2018
和4-1-2018
显示为禁用?这是我现在拥有的。我不需要动态设置日期。我需要显示其他禁用日期,以便用户可以看到更大范围的禁用日期
beforeShow : function () {
if (attrs.selecteddate) {
/*
2018-10-29T00:00:00.000+0000 before
2018-10-29 after
Only need the 00-00-0000 part of the date to avoid time zone issues. QoT always returns 00T for timezone anyways.
*/
var formattedDate = attrs.selecteddate.split("T");
attrs["formattedDate"] = formattedDate[0].substring(5) + "-" + formattedDate[0].substring(0, 4);
/*z
Set the date that the calander will display.
Append universal date time zone so correct date will be set in Firefox. It replaces T00:00:00.000+0000 with T12:00:00Z
*/
jQuery(this).datepicker('setDate', new Date(formattedDate[0] + 'T12:00:00Z'));
}
jQuery(this).datepicker('option', {
minDate : ( attrs.edittype === 'single' ) ? incrementDate(attrs.mindate) : attrs.mindate,
maxDate : ( attrs.edittype === 'single' ) ? convertToDateObj(attrs.maxdate) : attrs.maxdate
});
},
下面的js代码将帮助您动态更改最小和最大日期
$(函数(){
$(“#fdate”).datepicker({
格式日期:“年月日”,
onselect:function(){
//在这里做事
},
onclose:function(){
//在这里做事
}
});
var date1=“15-11-2017”;
var date2=“17-11-2017”;//您可以动态传递日期
$(“#fdate”).datepicker(“选项”,“minDate”,date1);
$(“#fdate”).datepicker(“选项”,“maxDate”,date2);
});代码>
可能重复从1月1日开始到4月4日结束,并禁用这两天发布您尝试的代码,或者以您尝试的代码的形式添加一些您的努力。