{hero}

maxDate

Since: DateTime 1.0.0

Set the maximum date that can be selected and displayed.
Please note - this property requires the DateTime extension for DataTables.

Description

This option allows a maximum selectable date to be imposed. This means that users won't be able to select dates that occur after the date set here.

Types

null

Description:

When this option is null there is no maximum date imposed by DateTime.

string

Description:

This option can also be a string. If this is the case it must be able to be taken by the Date constructor as an argument to create a Date instance to represent the maximum selectable date (i.e. an ISO 8601 or RFC 2822 string).

Date

Description:

This option can also be a directly given a Date object.

Default

  • Value: null

As default, no maximum date is applied to DateTime instances.

Examples

Set maxDate to the end of 2029 using a RFC 2822 string:

new DateTime(document.getElementById('test'), {
	maxDate: 'December 31, 2029 23:59:59'
});

Set maxDate to the end of 2029 using a Date (from ISO8601 format):

new DateTime(document.getElementById('test'), {
	maxDate: new Date('2029-12-31 23:59:59')
});

Related

The following options are directly related and may also be useful in your application development.