{hero}

disableDays

Since: DateTime 1.0.0

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

null

Description:

When this option is null any and all of the days of the week can be selected.

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, otherwise false.

Parameters:
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]
	});
});