Oxygen
Oxygen

Reputation: 871

How to allow only minutes in input type time

How can we enable time control to allow only time? When I enter 00:15 it automatically converts to 00 to 12. Can we achieve this by any way to allow time only? Or can we use this as input type="text" and restrict to accept time format only?

<input type="time" id="appt" min="0" name="appt">

I am referring to this example. https://www.w3schools.com/tags/tryit.asp?filename=tryhtml5_input_type_time

Upvotes: 0

Views: 3758

Answers (1)

Ejaj Ahmad
Ejaj Ahmad

Reputation: 80

When you type 00:15 in the time input, and it converts it 12:15, it actually is correct. Because if you want to set time to 00:15, there is no 00 in a clock, zero start with twelve in a clock.

Now, I don't know in which context you want to use that, but if you only want seconds or minutes. Maybe you can use an number input. <input type="number" placeholder="minutes">

Hope this helps!

Upvotes: 1

Related Questions