Input Month min Attribute

Definition and Usage

min attribute to set or return the value of the min attribute of the month field.

The HTML min attribute specifies the minimum value for the month field (month and year).

Tip:Use the min attribute and max attributes to create a series of valid values.

Tip:To set or return the value of the max attribute, use max Attribute.

See also:

HTML Reference Manual:HTML <input> min Attribute

Instance

Example 1

Get the minimum month and year allowed for the month field:

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

Try It Yourself

Example 2

Change the minimum value:

document.getElementById("myMonth").min = "2023-02";

Try It Yourself

Syntax

Return min attribute:

monthObject.min

Set min attribute:

monthObject.min = YYYY-MM

Attribute Value

Value Description
YYYY-MM

The minimum month and year allowed by the specification.

Component Description:

  • YYYY - Year (e.g., 2023)
  • MM - Month (e.g., 06 for June)

Technical Details

Return Value: A string value representing the minimum month and year allowed.

Browser Support

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support 10.0 Support Support Support

Note:The <input type="month"> element does not display any date field/calendar in Firefox.