Search code examples
jquerydateformatdatetimepicker

datetimepicker disabled dates


I'm trying to disable multiple random dates (closing dates of the company) on datetimepicker.

My code:

$('#datetimepicker').datetimepicker({
    format:'dd M. yyyy - h:00 uur',
    language: 'nl',
    startDate: '+2d',
    weekStart: '1',
    daysOfWeekDisabled:'6,0',
    maxView: '2',
    minView:'1',
    disabledDates: ['2015-08-25', '2015-08-26']
});

Any help?


Solution

  • Some of the options you have set don't exist in this version of the plugin, and/or are set incorrectly. Hopefully this will get you started in the right direction. http://jsfiddle.net/Ludz03xe/

    $('#datetimepicker1').datetimepicker({
        format:'LL LTS',
        locale: 'nl',
        defaultDate: moment().add(2,'days'),
        daysOfWeekDisabled: [0, 6],
        disabledDates: ['2015-08-25', '2015-08-26']
    });
    

    You may need to refer to moment formats to format your date as desired http://momentjs.com/docs/#/displaying/format/