Created
January 28, 2013 13:16
-
-
Save gsamokovarov/4655418 to your computer and use it in GitHub Desktop.
Simple check for invalid JavaScript dates.
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
_.mixin({ | |
// Invalid date predicate. The invalid dates are still `Date` instances, however their time is `NaN`. | |
isInvalidDate: function(obj) { | |
return _.isDate(obj) && _.isNaN(obj.getTime()); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment