【发布时间】:2017-11-13 17:39:33
【问题描述】:
我正在尝试显示日期选择器的其他禁用日期。例如,我的最小日期为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
});
},
【问题讨论】:
-
从 1 月 1 日开始,到 4 月 4 日结束,并禁用这两个工作日
-
请贴出你试过的代码
-
尝试以您尝试过的代码的形式添加您的一些努力。
标签: javascript jquery-ui-datepicker