日期值超出Safari Mobile中的日期限制 [英] Date value goes out of date constraints in Safari Mobile
问题描述
我试图了解iOS中< input type ="date">
的支持级别.我使用装有iOS 7.0.3的iPhone 4进行了测试,即使我指定了 min
属性,日期选择器也允许我选择约束之前的日期.
I am trying to understand the level of support of <input type="date">
in iOS. I tested it with an iPhone 4 with iOS 7.0.3, even if I specify a min
attribute the date picker lets me choose a date before the constraint.
HTML代码是这样的:
The HTML code is this:
<input type="date" id="checkIn" name="checkIn" class="form-control input-sm" value="2014-05-26" min="2014-05-26" data-date-format="YYYY-MM-DD" data-date-minDate="2014-05-26" placeholder="yyyy-mm-dd">
为此 datepicker 设置了数据属性,但是我通过 Modernizr ,所以我真的确定它在任何情况下都不会干扰日期选择器.
The data attributes are set for this datepicker but I detect the field support via Modernizr so I'm really sure it does not interfere in any case with the datepicker.
所以问题是:我做错了什么还是日期字段缺少约束支持?
So the question is: did I do something wrong or is the date field lacking constraints support?
推荐答案
我遇到了同样的问题.看起来虽然使用< input type ="date">
确实呈现了日期字段.min属性不起作用.该网站明确指出缺少支持.
I have been having the same issue. It looks like although using <input type="date">
does render a date field. The min attribute is not working.
This website clearly states that there is support lacking.
在网站上, iOS中的部分支持是指缺少对诸如step,min或max之类的属性的支持.您的操作没错.
From the website, Partial support in iOS refers to a lack of support for attributes like step, min, or max. You have not done anything wrong.
希望这能回答您的问题.
Hope this answers your question.
这篇关于日期值超出Safari Mobile中的日期限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!