I try to disable some dates after I have initialised the Date Picker.
I am initialising the picker like this:
$( document ).ready(function() {
$(
Make your changes from within the success/error handlers and try to enable all the dates before disabling:
function disableDates() {
var disabledDays = [];
var $input = $('#inputDatetime').pickadate();
var picker = $input.pickadate('picker');
$.ajax({
url: 'partners/getInactiveDays',
dataType: 'json',
async: false,
success: function(data) {
$.each(data.days, function(i, d) {
disabledDays.push(parseInt(d.Day.id));
});
picker.set('enable', true);
picker.set('disable', disabledDays);
},
error: function() {
picker.set('disable', true);
}
});
}