HTML: input type="month"
The month input collects a year and month, such as a billing period, without a specific day.
What you will learn
- How to label a month field
- How the submitted value is represented
- When date input is a better fit
Minimal example
<label for="billing-month">Billing month</label>
<input id="billing-month" name="billing-month" type="month" required>The submitted value is normalized as YYYY-MM. The calendar UI and visible formatting can vary between browsers and operating systems.
Common mistakes
- Do not invent a day when the business concept is only a month.
- Use
input type="date"when a specific day matters. - Validate the allowed period and interpret the month consistently on the server.