Input Date max Attribute
Definition and Usage
max
Set or return the value of the max attribute of the date field.
The HTML max attribute specifies the maximum value (date) for the date field.
Tip:Use the max attribute and min attribute to create a valid value range.
Tip:To set or return the value of the min attribute (the nearest date), use min Attribute.
See also:
HTML Reference Manual:HTML <input> max Attribute
Instance
Example 1
Get the furthest date allowed for the date field:
var x = document.getElementById("myDate").max;
Example 2
Change the furthest date:
document.getElementById("myDate").max = "2023-02-23";
Syntax
Return the max attribute:
inputdateObject.max
Set the max attribute:
inputdateObject.max = YYYY-MM-DD
Attribute Value
Value | Description |
---|---|
YYYY-MM-DD |
The furthest date allowed for the specified date field. Component Description:
For example: "2023-02-15" represents February 15, 2023 (15/02/2023). |
Technical Details
Return Value: | A string value that represents the latest date allowed. |
---|
Browser Support
The numbers in the table indicate the first browser version that fully supports this attribute.
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Support | 10.0 | Support | Support | Support |
Note:The <input type="date"> element does not display any date field/calendar in IE11 and earlier versions.