In google chrome if I set the value of an input of type datetime-local
to a time containing seconds where the seconds value is 0 Chrome decides not to show the seconds value on the input, meaning the user can't set the seconds at all.
E.g. If I set the value to 2013-10-24T20:36:01
then Chrome will show an input and the user can change the day, month, year, hours, minutes and seconds to whatever they want (including 0). If I set the value to 2013-10-24T20:36:00
then the seconds part disappears. I can understand it not being shown if no value for seconds was passed in but I am explicitly setting them to 0 so I would have assumed it would show them.
The reason why this is a problem is because I am reading the times from a database and if any of them have been set to 0 seconds the user can't change the time without hacking it with developer tools!
Am I missing something?
Thanks!
One thing the datetime-local input type doesn't provide is a way to set the time zone and/or locale of the date/time control. This was available in the datetime input type, but this type is now obsolete, having been removed from the spec.
The datetime input type is used in HTML using the <input type="datetime-local">. Using this, allow the users to select date and time. A date time picker popup is visible whenever input field is clicked. Note − The input type datetime is not supported in Firefox and Internet Explorer.
Adding step attribute will resolve your issue.
<input type=datetime-local value="2013-10-24T20:36:00" step="1">
The default value of step attribute is 60 (one minute).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With