amomin
amomin

Reputation: 406

HTML input time, step attribute to set timestep by (say) x minutes?

I have a time input, basically just:

Time: <input type="time" name="timeinput"/> 

http://jsfiddle.net/X8E9N/

According to http://www.w3.org/TR/html-markup/input.time.html it supports the step attribute. Is it possible to use this attribute (or other means) to set the step size to 10 minutes? If so, how?

I am aware of some other solutions (e.g. datebox plugin), but I'm hoping for a purely html solution if possible. I am using the datebox plugin sometimes, but it seems pretty slow on mobile devices so I am trying to use the native time pickers when possible.

Upvotes: 15

Views: 60408

Answers (4)

int32_t
int32_t

Reputation: 6150

Yes. You can specify step attribute in seconds.

However, Opera, iOS Safari, and Google Chrome don't reject non-aligned user input. A user can specify 11:59 to such time field. Then, Opera and Google Chrome show a validation error message when he tries to submit the form.

Upvotes: 13

kacper
kacper

Reputation: 370

It's possible. You just need to put seconds in step parameter, ex.

<input type="time" step="300"> <!-- 5 min step -->

Upvotes: 15

Anders Lind&#233;n
Anders Lind&#233;n

Reputation: 7323

Seems like Chrome 86 does not support this.

Upvotes: 12

mintedsky
mintedsky

Reputation: 1103

As of iOS 9.1, iOS doesn't support max min or step.

http://caniuse.com/#feat=input-datetime

Upvotes: 2

Related Questions