Date value goes out of date constraints in Safari Mobile

江枫思渺然 提交于 2021-02-10 05:26:16

问题


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.

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">

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?


回答1:


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.

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.



来源:https://stackoverflow.com/questions/23866692/date-value-goes-out-of-date-constraints-in-safari-mobile

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!