Skip to content

Instantly share code, notes, and snippets.

@6ui11em
Created May 23, 2018 17:14
Show Gist options
  • Save 6ui11em/0f810ca35edf5604b7a51a331db8df8b to your computer and use it in GitHub Desktop.
Save 6ui11em/0f810ca35edf5604b7a51a331db8df8b to your computer and use it in GitHub Desktop.
Javascript check input date browser supports #javascript #js #vanilla #data #browser
var isDateSupported = function () {
var input = document.createElement('input');
var value = 'a';
input.setAttribute('type', 'date');
input.setAttribute('value', value);
return (input.value !== value);
};
if (isDateSupported()) {
// Browser native date pickers are supported!
}
if (!isDateSupported()) {
// No support. Let's fallback to something else...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment