Skip to content

Instantly share code, notes, and snippets.

@gsamokovarov
Created January 28, 2013 13:16
Show Gist options
  • Save gsamokovarov/4655418 to your computer and use it in GitHub Desktop.
Save gsamokovarov/4655418 to your computer and use it in GitHub Desktop.
Simple check for invalid JavaScript dates.
_.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