Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Step" attribute not working on datetime-local

Tags:

html

input

I'm trying to use datetime-local to pick both date and time.

The input works okay, unfortunately I can't seem to get the step attribute to work at all.

The MDN docs seem to suggest I should be able to use it to set a step in seconds, however this just isn't working at all.

<form method='post' action='#'>
    <input
      type="datetime-local"
      id="meeting-time"
      name="meeting-time"
      value="2018-06-12T19:30"
      min="2018-06-07T00:00"
      max="2018-06-14T00:00"
      step="900"
    />
<input type='submit' value='Go!'>
</form>

Am I missing something?

like image 653
Leonardo Petrucci Avatar asked Dec 08 '25 10:12

Leonardo Petrucci


1 Answers

So, my confusion came from the fact that step doesn't change the steps that appear in the calendar nor stops users from typing the time in themselves.

The step attribute does "work" in loosest sense possible in that it allows users to step between values with arrows after selecting them with the keyboard.

like image 168
Leonardo Petrucci Avatar answered Dec 10 '25 00:12

Leonardo Petrucci



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!