Is there an alternative for that because Firefox and Internet Explorer are not supporting it...
Example:
<form>
<input type="datetime-local">
</form>
If the time zone is not important to your application, use datetime-local. Some browsers are still trying to catch up to the datetime input type. Firefox 7 has still not shown any progress in this area. Instead, set up your own using three select fields with options that are populated in relation to today's date.
Input type "datetime-local" is not supported in Firefox hence it shows a text box, in this case, you can use input type as "date". As "datetime-local" shows the time as well and if you have the same requirement, you can use Input type "time" also to show the time. I hope this helps.
The datetime-local input uses HTML's native datetime-local picker to allow users to easily select a date and time based on their browser's locale. The internal format of all native datetime-local pickers is YYYY-MM-DDTHH:MM .
You can use <input type="date"> <input type="time">
together. Personally I think this is why datetime-local was removed. There are some great polyfills as well, like this one: http://afarkas.github.io/webshim/demos/index.html
I ran across this while looking for something to use instead of datetime-local
https://www.daterangepicker.com/
It has similar functionality to datetime-local
and some extra. The one thing you would have to account for is being able to limit users' changing the date values in the input box if you do it that way. datetime-local
automatically prevents say, putting letters into the time values.
Otherwise, Jonathan's answer still seems the best basic built-in option that works with FF/Chrome.
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