Skip to content

Instantly share code, notes, and snippets.

@adaniliuk
Created April 6, 2015 12:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adaniliuk/f2bc7b3c9cff1dacef9b to your computer and use it in GitHub Desktop.
Save adaniliuk/f2bc7b3c9cff1dacef9b to your computer and use it in GitHub Desktop.
Checks if html5 input type date is supported
'use strict';
module.exports = {
/**
* Checks if html5 input date is supported
*
* @return {Boolean} True if html5 input date is supported by the client browser
*/
isInputDateSupported: function () {
var el = document.createElement('input'),
fakeValue = 'fake-date';
el.setAttribute('type', 'date');
el.setAttribute('value', fakeValue);
return !(el.value === fakeValue);
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment