Html IE11 和 Firefox 中的日期选择器支持
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/27534118/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Datepicker Support in IE11 and Firefox
提问by Vlad from Moscow
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>
回答by Sampson
Internet Explorer 11 does not currently support <input type='date'>
, though we did recently announcethat work was underway to do so. You can track that progress online at http://status.modern.ie.
Internet Explorer 11 目前不支持<input type='date'>
,但我们最近确实宣布正在进行这项工作。您可以在http://status.modern.ie在线跟踪该进度。
Firefox supports<input type='date'>
. The bug requesting support was closed on June 22, 2016
火狐支持<input type='date'>
. 请求支持的错误已于2016年6 月 22 日关闭
If you need this functionality today, I would encourage you to use jQuery's Datepicker.
如果您今天需要此功能,我鼓励您使用jQuery 的 Datepicker。
回答by GlenPeterson
Feb 2019 Update:
2019 年 2 月更新:
Edge supports the datepicker, but after 4+ years, it looks like IE never will. Same with Safari desktop (though Safari mobile supports it). See: CanIUse datepicker support.
Edge 支持日期选择器,但 4 年多之后,IE 似乎永远不会了。与 Safari 桌面版相同(尽管 Safari 移动版支持它)。请参阅:CanIUse 日期选择器支持。
Chrome and Edge take the date format from the user's desktop system settings, which may be surprising if you're expecting ISO 8601and 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. the Bootstrap 4 docs show the SLIM version, which tripped me up for a bit.
仅当您使用 REGULAR JQuery 发行版时,JQuery 的日期选择器才适用于 bootstrap 4。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.
- Some friends recommended the eyecon Datepicker for Bootstrapwhich I guess is the original that uxsolutions is forked from.
- Pickadayis pretty popular, though the JS Deliver CDNcurrently lacks an integrity hashcode and there's no pre-built download - you have to build with node or something.
- uxsolutions bootstrap-datepicker“一个用于 Bootstrap 的日期选择器从 Stefan Petre 的(eyecon.ro)分叉出来,由 eternicode 改进”在 github 上有很多明星,似乎可以与 bootstrap 4 一起使用。
- 一些朋友推荐了用于 Bootstrap的eyecon Datepicker,我猜它是 uxsolutions 的原始分支。
- Pickaday非常受欢迎,尽管JS Deliver CDN目前缺乏完整性哈希码并且没有预先构建的下载 - 您必须使用 node 或其他东西进行构建。
回答by user1909711
It is already in Firefox since version 51 (January 26, 2017), but it is not activated by default (yet). To activate it:
自版本 51(2017 年 1 月 26 日)以来,它已经在 Firefox 中,但默认情况下(尚未)激活。要激活它:
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
。