diff --git a/jquery.datetimepicker.js b/jquery.datetimepicker.js index 2cc09a9..1684774 100644 --- a/jquery.datetimepicker.js +++ b/jquery.datetimepicker.js @@ -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'); }