Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

W3C validation error for input type=date

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

like image 520
Prince Kumar Barnwal Avatar asked Aug 18 '17 05:08

Prince Kumar Barnwal


1 Answers

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:

  • https://www.npmjs.com/package/nodep-date-input-polyfill
  • https://github.com/chemerisuk/better-dateinput-polyfill
  • https://github.com/liorwohl/html5-simple-date-input-polyfill
  • https://github.com/dxw/date-polyfill
  • https://github.com/jonstipe/date-polyfill
like image 77
sideshowbarker Avatar answered Oct 15 '22 23:10

sideshowbarker