Input Week min Attribute

Definition and Usage

min Set or return the value of the min attribute of the week field.

HTML min attribute specifies the minimum value (week and year) of the week field.

Tip:The min attribute is usually used with max attribute 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

Example

Example 1

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

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

Try It Yourself

Example 2

Change the allowed minimum week number and year:

document.getElementById("myWeek").min = "2023-W05";

Try It Yourself

Syntax

Return min attribute:

weekObject.min

Set min attribute:

weekObject.min = YYYY-WWW

Attribute Value

Value Description
YYYY-WWW

The minimum week and year allowed by the specification.

Component Description:

  • YYYY - Year (for example, 2023)
  • String "-W" indicates "week"
  • WW - Week (within the range of 1 to 52 or 53, depending on the specific year, for example, 01 represents the first week of the year)

For example: 2023-W36

Technical Details

Return Value: A string value that represents the minimum week 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="week"> element does not display any date field/calendar in Firefox.