add allowdates option

This commit is contained in:
xiaoyu5256 2016-01-08 12:30:45 +08:00
parent d9836d4bd0
commit 4d1c6b7b26

View File

@ -596,6 +596,7 @@
weekends: [], weekends: [],
highlightedDates: [], highlightedDates: [],
highlightedPeriods: [], highlightedPeriods: [],
allowDates : [],
disabledDates : [], disabledDates : [],
disabledWeekDays: [], disabledWeekDays: [],
yearOffset: 0, yearOffset: 0,
@ -1050,6 +1051,10 @@
options.weekends = $.extend(true, [], _options.weekends); options.weekends = $.extend(true, [], _options.weekends);
} }
if (_options.allowDates && $.isArray(_options.allowDates) && _options.allowDates.length) {
options.allowDates = $.extend(true, [], _options.allowDates);
}
if (_options.highlightedDates && $.isArray(_options.highlightedDates) && _options.highlightedDates.length) { if (_options.highlightedDates && $.isArray(_options.highlightedDates) && _options.highlightedDates.length) {
$.each(_options.highlightedDates, function (index, value) { $.each(_options.highlightedDates, function (index, value) {
var splitData = $.map(value.split(','), $.trim), var splitData = $.map(value.split(','), $.trim),
@ -1660,7 +1665,11 @@
customDateSettings = null; customDateSettings = null;
} }
if ((maxDate !== false && start > maxDate) || (minDate !== false && start < minDate) || (customDateSettings && customDateSettings[0] === false)) { if(options.allowDates&&options.allowDates.length>0){
if(options.allowDates.indexOf(start.dateFormat(options.formatDate)) === -1){
classes.push('xdsoft_disabled');
}
} else if ((maxDate !== false && start > maxDate) || (minDate !== false && start < minDate) || (customDateSettings && customDateSettings[0] === false)) {
classes.push('xdsoft_disabled'); classes.push('xdsoft_disabled');
} else if (options.disabledDates.indexOf(dateHelper.formatDate(start, options.formatDate)) !== -1) { } else if (options.disabledDates.indexOf(dateHelper.formatDate(start, options.formatDate)) !== -1) {
classes.push('xdsoft_disabled'); classes.push('xdsoft_disabled');