Search code examples
javascripttwitter-bootstrapdaterangepicker

Bootstrap Date Range Picker disable dates


How do I block the availability of some dates in Date Range Picker?

For example:

['22/07/2016', '26/07/2016', '29/07/2016']

Thank


Solution

  • You can use isInvalidDate function.

    For example disable Sundays and Saturdays:

    isInvalidDate: function(date) {
      return (date.day() == 0 || date.day() == 6);
    }
    

    Or disable specific date:

    isInvalidDate: function(date) {
        if (date.format('YYYY-MM-DD') == '2016-08-01') {
            return true; 
        } else {
            return false; 
        }
    }