<input type="date" max="1995-12-31" class="form-control" id="dob"/>
When I try to validate with W3C I got error for this line:
The date input type is not supported in all browsers. Please be sure to test, and consider using a polyfill.
How to solve it?
Maintainer of the W3C HTML checker (validator) here. That message is just a warning message, not an error. And the reason we have the HTML checker emit that warning is, input type=date
isn’t supported in desktop Safari or Internet Explorer, nor in versions of Firefox before Firefox 57, nor on Android before Android 4.4.
For the exact details about browser support, see https://caniuse.com/#search=date
So that warning’s purpose is to give you a heads-up that your document has a feature that doesn’t work as specified for users of Internet Explorer, Safari, and older versions of Firefox and Android.
That’s why the warning specifically mentions that you consider using a polyfill—in order to ensure that the feature works for all your users as expected.
To make input type=date
work in all browsers, you can choose among many available polyfills: