I’m working on a small Angular application, and I’m using the following HTML element for when the user sets the start hours:
<input type="time">
I’ve noticed that this element adopts either the 12-hour or 24-hour format based on the user’s system locale. Is there a way to consistently enforce the use of the 24-hour format for this element, regardless of the system locale?
Or alternatively, are there any JavaScript workarounds available?
2
Answers
You can use the TimePicker.js library:
Full Code
https://jsfiddle.net/SeiryuV/qzn12um3/12/
No, and (per MDN):
which is even less strict.
If your UI requirements differ from what is afforded by browsers, then you must implement (or find) a custom input that meets those requirements, including validation of the user input.