Input Week max attribute

Definition and usage

max Attribute setting or returning the value of the max attribute of the week field.

The HTML max attribute specifies the maximum value (week and year) for the week field.

Tip:The max attribute is usually used with min attribute Use together to create a series of valid values.

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

See also:

HTML Reference Manual:HTML <input> max attribute

Instance

Example 1

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

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

Try it yourself

Example 2

Change the maximum allowed week and year:

document.getElementById("myWeek").max = "2023-W35";

Try it yourself

Syntax

Return max attribute:

weekObject.max

Set max attribute:

weekObject.max = YYYY-WWW

Attribute value

Value Description
YYYY-WWW

Maximum allowed week and year specified.

Component description:

  • YYYY - Year (e.g., 2023)
  • String "-W" indicates 'week'
  • WW - Week (in 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: String value, representing the maximum weeks and years 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.