问题
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