Added disabledDates options

This commit is contained in:
Valeriy 2014-10-23 17:35:13 +06:00
parent ee7047e204
commit f49674765a
2 changed files with 10 additions and 2 deletions

View File

@ -63,7 +63,8 @@ window.onerror = function(errorMsg) {
}*/ }*/
$('#datetimepicker').datetimepicker({ $('#datetimepicker').datetimepicker({
dayOfWeekStart : 1, dayOfWeekStart : 1,
lang:'ru', lang:'en',
disabledDates:['1986/01/08','1986/01/09','1986/01/10'],
startDate: '1986/01/05' startDate: '1986/01/05'
}); });
$('#datetimepicker').datetimepicker({value:'2015/04/15 05:03',step:10}); $('#datetimepicker').datetimepicker({value:'2015/04/15 05:03',step:10});

View File

@ -302,6 +302,7 @@
roundTime: 'round', // ceil, floor roundTime: 'round', // ceil, floor
className: '', className: '',
weekends: [], weekends: [],
disabledDates : [],
yearOffset: 0, yearOffset: 0,
beforeShowDay: null beforeShowDay: null
}; };
@ -623,6 +624,10 @@
options.weekends = $.extend(true, [], _options.weekends); options.weekends = $.extend(true, [], _options.weekends);
} }
if( _options.disabledDates && $.isArray(_options.disabledDates) && _options.disabledDates.length ){
options.disabledDates = $.extend(true,[],_options.disabledDates);
}
if ((options.open || options.opened) && (!options.inline)) { if ((options.open || options.opened) && (!options.inline)) {
input.trigger('open.xdsoft'); input.trigger('open.xdsoft');
} }
@ -1146,6 +1151,8 @@
if ((maxDate !== false && start > maxDate) || (minDate !== false && start < minDate) || (customDateSettings && customDateSettings[0] === false)) { 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(start.dateFormat(options.formatDate)) !== -1) {
classes.push('xdsoft_disabled');
} }
if (customDateSettings && customDateSettings[1] !== "") { if (customDateSettings && customDateSettings[1] !== "") {