Created
August 18, 2014 00:57
-
-
Save Alex1990/9862372dccead5830efd to your computer and use it in GitHub Desktop.
Check if an object is a valid Date object
This file contains 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
/* | |
* 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