Input Date step attribute

Definition and usage

step Set or return the value of the step attribute of the date field.

The HTML step attribute specifies the legal date intervals that the user can select when opening the date field.

For example, if step = "2", then you can only select every other day in the calendar.

See also:

HTML Reference Manual:HTML <input> step Attribute

Example

Example 1

Change the legal number of days between dates:

document.getElementById("myDate").step = "2";

Try it yourself

Example 2

Get a valid date interval:

var x = document.getElementById("myDate").step;

Try it yourself

Syntax

Return the step attribute:

inputdateObject.step

Set the step attribute:

inputdateObject.step = number

Attribute value

Value Description
number

Specify the legal number of days between dates. The default is 1 day.

For example:

  • If step="2", then you can only select every other day in the date calendar.
  • If step="10", you can only select every nine days on the date calendar.

Technical Details

Return Value: Numeric value, representing the valid number of days.

Browser Support

The numbers in the table indicate the first browser version that fully supports this attribute.

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support 10.0 Support Support Support

Note:The <input type="date"> element does not display any date field/calendar in IE11 and earlier versions.