Alternative to datetime-local?

前端 未结 4 1994
被撕碎了的回忆
被撕碎了的回忆 2021-01-18 08:23

Is there a alternative for that because Firefox and Internet Explorer are not supporting it...

Example:

相关标签:
4条回答
  • 2021-01-18 08:27

    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.

    0 讨论(0)
  • 2021-01-18 08:29

    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

    0 讨论(0)
  • 2021-01-18 08:34

    In my case, I tried many things but nothing looks perfect, finally, I came with this walk around to split the datetime into two inline inputs and remove the border between them to looks like just one input variable:

    <form action="" class="form-inline">
    <div class="form-group">
        <input class="form-control" style=" border-right-style: none" type="date" max="9999-12-12T00:00:00.00" />
    </div>
    <div class="form-group">
        <input class="form-control" style=" border-left-style: none" type="time" max="9999-12-12T00:00:00.00" />
    </div>
    

    0 讨论(0)
  • 2021-01-18 08:42

    By my side I'm using a class (datetime-local) on all the inputs with type datetime-local. Then I can replace all these inputs by a custome version: CalendarPopup (https://xdsoft.net/jqplugins/calendar-popup/)

    var calendar = $('input.datetime-local').CalendarPopup();

    0 讨论(0)
提交回复
热议问题