Limit bootstrap-datepicker to weekdays only?

The latest version from https://github.com/eternicode/bootstrap-datepicker already has an option to disable selection of particular weekdays. From the docs:

daysOfWeekDisabled

String, Array. Default: ‘’, []

Days of the week that should be disabled. Values are 0 (Sunday) to 6 (Saturday). Multiple values should be comma-separated. Example: disable weekends: '0,6' or [0,6].

In other words, just instantiate your datepicker like this:

$('#datepicker').datepicker({
    daysOfWeekDisabled: [0,6]
});

Here’s a jsfiddle demonstrating this: http://jsfiddle.net/vj77M/1/

Leave a Comment