本文介绍了为什么 HTML5 输入类型 datetime 从已经支持它的浏览器中删除?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道为什么过去支持输入 datetime 的所有浏览器(例如高于 26 的 Chrome 版本)都删除了它?

I was wondering why all browsers, like Chrome versions higher than 26, which had support in the past for the input datetime removed it?

这听起来像 这篇文章,但那篇文章已经很老了.

This sounds like a duplicate of this article, but that one is quite aged.

看起来 HTML WG 更喜欢 datetime-local (w3c)高于 datetime(w3c),但为什么呢?

It looks like the HTML WG prefers datetime-local (w3c) above datetime (w3c), but why?

有关功能,请参见this开发时间表.

See this for feature development timeline.

别人怎么说:

根据 mobilexweb.com 它已被弃用在 iOS 中'因为它看起来太像日期时间输入类型'.

According to mobilexweb.com it was deprecated in iOS 'because it looks too much like the datetime input type'.

继 Google Chrome 之后,现在 iOS 上的 Safari 不支持日期时间输入类型不再,它将回退到文本.这种类型在标准中不推荐使用日期时间本地或使用两个用于相同目的的输入、日期和时间.问题是datetime 兼容 iOS 从 5.0 到 6.1 版本;如果你是使用时要小心!

有什么区别?

其中 datetime-local 仅包含日期和时间元素,datetime 还包含时区.这很有用,因为当客户端的时区与服务器的时区不同时,您可能希望采取不同的操作.

Where datetime-local contains only a date and time element, datetime also contains the time zone. This is useful since you might want to act differently when the client's time zone is different from the server's one.

为什么这很重要?

如果网页询问:你希望我什么时候给你打电话,而用户选择明天,下午 3 点",你需要什么时候给他回电话?明天下午 3 点(UTC 或欧洲中部时间)?

推荐答案

我能想到的唯一原因是浏览器供应商对被批准的标准失去信心,因此从他们的代码中删除了实现.

The only reason I can think of is browser vendors losing faith in the standard being approved, therefore removing the implementation from their code.

为了支持这个想法:W3C 刚刚从他们的工作草案中删除了 datetimedatetime-local.

To support this thought: W3C just removed both datetime and datetime-local from their working draft.

浏览器供应商最终会放弃对两者的支持.

Browser vendors will eventually drop support of both of them.

根据 html5test 目前大多数浏览器都取消了对两者的支持输入类型.

According to html5test most of the current browsers removed support of both of the input types.

最新进展:

  • datetime-local 重新回到草案中;
  • 较新的规范页面不显示 datetime,但会显示 datetime-local.听起来它确实重新出现在地图上并且将再次得到支持!
  • The datetime-local is back on the draft;
  • The newer specs page doesn't show datetime, but it does show datetime-local. It does sound like it is back on the map and going to be supported again!

还要注意 Webmasters.SE 上的这篇相关帖子:是否从 HTML 5.1 中删除了本地日期时间?.

Also take notice of this related post on Webmasters.SE: Is datetime-local removed from HTML 5.1?.

这篇关于为什么 HTML5 输入类型 datetime 从已经支持它的浏览器中删除?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-19 05:54