Skip to content

Instantly share code, notes, and snippets.

@dan-codes-16
Created April 6, 2015 12:28
Show Gist options
  • Save dan-codes-16/f2bc7b3c9cff1dacef9b to your computer and use it in GitHub Desktop.
Save dan-codes-16/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