1
votes

There are plenty of questions on this but none of them seem to have worked for me.

I will eventually have an array of dates being passed in for multiple days over different months.

I'm using this version of the bootstrap datepicker https://bootstrap-datepicker.readthedocs.io/en/latest/

looking over the docs, a simple array of dates for'disabledDates' should be all it needs to get these working, but I'll be damned if it accepts it.

Any ideas as to why it doesn't work?

var disabledDates = ['28/3/2018','22/3/2018'];

$('.datepicker').datepicker({
    format: 'DD/MM/YYYY',
    maxViewMode: 1,
    todayBtn: "linked",
    clearBtn: true,
    multidate: true,
    daysOfWeekDisabled: "0,6",
    datesDisabled: disabledDates
})
1

1 Answers

1
votes

In disabledDates variable you used dates like '28/3/2018' and '22/3/2018'. According to the doc these dates are in this format d/m/yyyy or dd/m/yyyy.

But, inside datepicker() function you have declared the date format as DD/MM/YYYY.

Try to change the date format format: 'DD/MM/YYYY', to format: 'd/m/yyyy', or format: 'dd/m/yyyy',