Force the use of a 24-hour time input type regardless of system locale
P粉189606269
P粉189606269 2023-08-18 12:27:18
0
1
548
<p>I'm developing a small Angular application and I'm using the following HTML element when the user sets a start time: </p> <p><br /></p> <pre class="brush:html;toolbar:false;"><input type="time"></pre> <p><br /></p> <p>I noticed that this element works in 12-hour or 24-hour time depending on the user's system locale. Is there a way to always force a 24-hour clock, regardless of the system locale? </p> <p>Alternatively, are there any JavaScript solutions available? </p>
P粉189606269
P粉189606269

reply all(1)
P粉343141633

No, and (according to MDN):

This is even less strict.

If your user interface requirements differ from those provided by the browser, then you must implement (or find) a custom input that meets those requirements, including validating the user input.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template