Search code examples
htmlattributesmaxmin

How to set min and max attributes for input type week


I dont want users to select weeks below and above a specific date. I can't seem to figure out how it works. I know about the attributes min and max, and know how to use them for a date picker. But not for a week picker. I have tried the following:

<input type="week" min="01-01-2021" max="31-12-2021">
<input type="week" min="01-2021" max="52-2021">
<input type="week" min="2021-01" max="2021-05">
// Etc. etc.

Solution

  • So I figured out that on this page it says we should use this:

    <input type="week" min="2021-W01" max="2021-W52">
    

    And it works :)