Skip to content

Instantly share code, notes, and snippets.

@Alex1990
Created August 18, 2014 00:57
Show Gist options
  • Save Alex1990/9862372dccead5830efd to your computer and use it in GitHub Desktop.
Save Alex1990/9862372dccead5830efd to your computer and use it in GitHub Desktop.
Check if an object is a valid Date object
/*
* Ref: http://stackoverflow.com/questions/1353684/detecting-an-invalid-date-date-instance-in-javascript
*/
function isValidDate(d) {
return Object.prototype.toString.call(d) === '[object Date]' && !isNaN(d.valueOf());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment