Input Date min Attribute

Definition and Usage

min Sets or returns the value of the min attribute of the date field.

The HTML min attribute specifies the minimum value (date) for the date field.

Tip:Use the min attribute and max attribute to create a valid value range.

Tip:To set or return the value of the max attribute (the farthest date), use max Attribute.

See also:

HTML Reference Manual:HTML <input> min Attribute

Instance

Example 1

Get the nearest date allowed for the date field:

var x = document.getElementById("myDate").min;

Try It Yourself

Example 2

Change the nearest date:

document.getElementById("myDate").min = "2021-01-01";

Try It Yourself

Syntax

Return min attribute:

inputdateObject.min

Set min attribute:

inputdateObject.min = YYYY-MM-DD

Attribute Value

Value Description
YYYY-MM-DD

The nearest date allowed for the specified date field.

Component Description:

  • YYYY - The year (e.g., 2023)
  • MM - The month (e.g., 02 represents January)
  • DD - A specific day of the month (e.g., 15)

For example: "2023-02-15" represents February 15, 2023 (15/02/2023).

Technical Details

Return Value: A string value representing the latest allowed date.

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.