Created
May 23, 2018 17:14
-
-
Save 6ui11em/0f810ca35edf5604b7a51a331db8df8b to your computer and use it in GitHub Desktop.
Javascript check input date browser supports #javascript #js #vanilla #data #browser
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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