disableDays
Specify days that cannot be selected.
Please note - this property requires the DateTime extension for DataTables.
Description
This option allows for certain days to be unselectable. This is done by either setting this option to an array or function as detailed below.
Types
number[]
- Description:
When this option is an array of numbers, any of the days indexes (0 indexed starting from Sunday) that are present here will not be selectable within the DateTime picker.
function disableDays(day)
- Description:
If this option is a function it should take one parameter, a number representing the index of the day being checked (again, 0 indexed starting from Sunday) if that day should be selectable it returns
true
, otherwisefalse
.- Parameters:
Name Type Optional 1 day
No The index of the day to check if it is disabled or not.
- Returns:
Default
- Value:
null
As default, all of the days can be selected.
Example
Disable selection of Saturdays and Sundays:
$(document).ready(function () {
new DateTime(document.getElementById('test'), {
disableDays: [5, 6]
});
});