Dofactory.com
Dofactory.com

HTML <input> type="week"

The <input> tag with a type="week" attribute creates an input field that accepts a week and year value.

Inside this field is a calendar icon. Clicking this icon opens a week/year picker.

Example

#

An <input> element of type week.
Clicking the calendar icon opens a week/year picker. Alternatively, enter a value directly into the field.

Select Week/Year

<form action="/tutorial/action.html">
  <fieldset>
    <legend>Select Week/Year</legend>

    <input type="week" name="week"><br /><br />

    <input type="submit" value="Submit">
  </fieldset>
</form>

Using input type="week"

The <input type="week"> creates an input field that accepts week and year data.

Clicking the calendar icon inside the field will open a week/year picker.

The control's UI varies from browser to browser. Browser support is spotty.

The week field also accepts manual entry which follows a week and year format.


Syntax

<input type="week">

Browser support

Here is when type="week" support started for each browser:

Chrome
25.0 Feb 2013
Firefox
Not Supported
IE/Edge
12.0 Jul 2015
Opera
10.1 Jun 2009
Safari
Not Supported

You may also like

 Back to <input>

Author: Jack Poorte
Published: Jun 20 2021
Last Reviewed: Sep 30 2023


What's your favorite/least favorite part of Dofactory?


Guides