Merge pull request #376 from xiaoyu5256/master

add feature allow date by regex
This commit is contained in:
Valeriy 2016-01-18 10:49:31 +05:00
commit 1db3359144

View File

@ -597,6 +597,7 @@
highlightedDates: [],
highlightedPeriods: [],
allowDates : [],
allowDateRe : null,
disabledDates : [],
disabledWeekDays: [],
yearOffset: 0,
@ -1054,6 +1055,10 @@
if (_options.allowDates && $.isArray(_options.allowDates) && _options.allowDates.length) {
options.allowDates = $.extend(true, [], _options.allowDates);
}
if (_options.allowDateRe && Object.prototype.toString.call(_options.allowDateRe)==="[object String]") {
options.allowDateRe = new RegExp(_options.allowDateRe);
}
if (_options.highlightedDates && $.isArray(_options.highlightedDates) && _options.highlightedDates.length) {
$.each(_options.highlightedDates, function (index, value) {
@ -1665,7 +1670,11 @@
customDateSettings = null;
}
if(options.allowDates&&options.allowDates.length>0){
if(options.allowDateRe && Object.prototype.toString.call(options.allowDateRe) === "[object RegExp]"){
if(!options.allowDateRe.test(start.dateFormat(options.formatDate))){
classes.push('xdsoft_disabled');
}
} else if(options.allowDates && options.allowDates.length>0){
if(options.allowDates.indexOf(start.dateFormat(options.formatDate)) === -1){
classes.push('xdsoft_disabled');
}