4 ms·
HTML5 has type="date" for input fields. It'd be kinda cool if this could automatically use those in situations where the browser doesn't support the picker nati
by petercooper 14y ago
HTML5 has type="date" for input fields. It'd be kinda cool if this could automatically use those in situations where the browser doesn't support the picker natively. Unless I totally misunderstand the point ;-)
- jlogsdon 14y agoThat would be up to the consumer. If you look at his demo code he attaches it to `input[type=date]` already: https://github.com/amsul/pickadate.js/blob/gh-pages/index.htm#L140 https://github.com/amsul/pickadate.js/blob/gh-pages/index.ht...
- ville 14y agoSupport for input type="date" can be tested by creating an element like that and checking the type attribute. But how can you tell if the browser has support for the native picker? You can't. That is why this picker takes the approach of changing the type date always to text to prevent double date pickers.
- petercooper 14y agoBut how can you tell if the browser has support for the native picker? You can't. That's what I was wondering. If there were a way, it'd be pretty awesome to use a library like this as a polyfill rather than as a separate thing you attach to text inputs.
- leh0n 14y agoYou can. Modernizr will tell you if the browser supports the native picker. http://modernizr.com/ http://modernizr.com/
- ville 14y agoIt doesn't tell that. From Modernizr wiki[0]: "webforms UI: datepicker, colorpicker UIs cannot be detected, only the associated constraint validation" [0]: https://github.com/Modernizr/Modernizr/wiki/Undetectables https://github.com/Modernizr/Modernizr/wiki/Undetectables