And what if you input invalid date, e.g. 2016/2/30?
W3C HTML5 spec says
The value sanitization algorithm is as follows: If the value of the element is not a valid date string, then set it to the empty string instead.So you never get an original invalid date value.
How can you handle it?
You only know if a value is invalid or not with...
- input.validity.badInput
- input.validity.valid
- input.validationMessage
Further details, please see this: http://stackoverflow.com/questions/13278016/get-input-value-from-html5-inputtype-date-in-chrome/24081375#24081375
No comments:
Post a Comment