Why has Chrome on Android's native HTML5 date picker become really slow?

前端 未结 2 653
后悔当初
后悔当初 2021-02-13 00:35

I have a date picker on my site that just uses the default html5 date picker.

I\'ve noticed that up until a couple of weeks ago, it was working fine but ever since a rec

相关标签:
2条回答
  • 2021-02-13 01:06

    See crbug.com/441060 . You can avoid this slowness by specifying min= and max= attributes.

    0 讨论(0)
  • 2021-02-13 01:17

    For a bit more info, I did some playing around with setting no min/max, max only, and min and max. Each has different behaviour/performance.

    No min or max - clicking in Android will be very slow

    <input type="date">
    

    Max only - clicking in Android will set your default value to 01/01/0001 - the first day ever. Not useful

    <input type="date" max="1979-12-31">
    

    Min and max - default date is today, and it loads very quickly!

    <input type="date" min="0001-01-01" max="9999-12-31" >
    

    https://jsfiddle.net/gpjc3xam/16/


    Update

    For anyone using this solution with Angular, please note that a min date in the year 0001 will not work. It seems that the year 100 is the lowest Javascript will allow...

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