简体   繁体   English

IE11 和 Firefox 中的日期选择器支持

[英]Datepicker Support in IE11 and Firefox

What is wrong with this simple HTML page that a date picker is not shown in FireFox 30.0 and IE 11?这个简单的 HTML 页面有什么问题,在 FireFox 30.0 和 IE 11 中没有显示日期选择器?

<!DOCTYPE html>
<html>
    <head>
        <title>Untitled Page</title>
    </head>
    <body>
        <form>
            <label> Date field:</label><br />
            <input type="date" value="" />
        </form>
    </body>
</html>

Internet Explorer 11 does not currently support <input type='date'> , though we did recently announce that work was underway to do so. Internet Explorer 11 目前不支持<input type='date'> ,尽管我们最近确实宣布正在进行这项工作。 You can track that progress online at http://status.modern.ie .您可以在http://status.modern.ie在线跟踪该进度。

Firefox supports <input type='date'> . Firefox 支持<input type='date'> The bug requesting support was closed on June 22, 2016请求支持的错误已于20166 月 22 日关闭

If you need this functionality today , I would encourage you to use jQuery's Datepicker .如果您今天需要此功能,我鼓励您使用jQuery 的 Datepicker

Feb 2019 Update: 2019 年 2 月更新:

Edge supports the datepicker, but after 4+ years, it looks like IE never will. Edge 支持日期选择器,但 4 年多之后,IE 似乎永远不会了。 Same with Safari desktop (though Safari mobile supports it).与 Safari 桌面版相同(尽管 Safari 移动版支持它)。 See: CanIUse datepicker support .请参阅: CanIUse 日期选择器支持

Chrome and Edge take the date format from the user's desktop system settings, which may be surprising if you're expecting ISO 8601 and your users don't live in Denmark or Canada. Chrome 和 Edge 从用户的桌面系统设置中获取日期格式,如果您期待ISO 8601并且您的用户不居住在丹麦或加拿大,这可能会令人惊讶。

JQuery's datepicker works with bootstrap 4 only if you use the REGULAR JQuery distribution.仅当您使用 REGULAR JQuery 发行版时,JQuery 的日期选择器才适用于 bootstrap 4。 the Bootstrap 4 docs show the SLIM version, which tripped me up for a bit. Bootstrap 4 文档显示了 SLIM 版本,这让我有点困惑。

Other alternatives:其他选择:

  • uxsolutions bootstrap-datepicker "A datepicker for Bootstrap forked from Stefan Petre's (of eyecon.ro), improvements by eternicode" has a lot of stars on github and seems to work with bootstrap 4. uxsolutions bootstrap-datepicker “一个用于 Bootstrap 的日期选择器从 Stefan Petre's (of eyecon.ro) 分叉出来,由 eternicode 改进”在 github 上有很多明星,似乎可以与 bootstrap 4 一起使用。
  • Some friends recommended the eyecon Datepicker for Bootstrap which I guess is the original that uxsolutions is forked from.一些朋友推荐了用于 Bootstrapeyecon Datepicker ,我猜它是 uxsolutions 的原始分支。
  • Pickaday is pretty popular, though the JS Deliver CDN currently lacks an integrity hashcode and there's no pre-built download - you have to build with node or something. Pickaday非常受欢迎,尽管JS Deliver CDN目前缺乏完整性哈希码并且没有预构建的下载 - 您必须使用 node 或其他东西进行构建。

It is already in Firefox since version 51 (January 26, 2017), but it is not activated by default (yet).自版本 51(2017 年 1 月 26 日)以来,它已经在 Firefox 中,但默认情况下(尚未)激活。 To activate it:要激活它:

Go to "about:config" in your address bar, then search for the dom.forms.datetime property and set it to true .转到地址栏中的“about:config”,然后搜索dom.forms.datetime属性并将其设置为true

Flatpickr is very light weight and one of the best date pickers available. Flatpickr的重量很轻,是目前最好的日期选择器之一。 It's blazing fast in every browser including IE. 在包括IE在内的所有浏览器中,它的速度都非常快。 Its Github repo is very active and has over 12.4k stars. 它的Github存储库非常活跃,拥有超过1.24万颗星。 It's licensed under the MIT License. 它是根据MIT许可授权的。

Disclaimer: I am one of the contributors of this awesome project 免责声明:我是这个很棒的项目的贡献者之一

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM