jashkenas/underscore — pull request #1694 by onury (2014-06-19 20:30:05+00:00)
Title: Improved isDate() method

`isDate()` does not check for the weird `Invalid Date`

var date = new Date('not a date'); // Invalid Date
_.isDate(date); // true

Now, also testing with `!isNaN(date.getTime())`

_.isDate = function(obj) {
return toString.call(obj) === '[object Date]' && !isNaN(obj.getTime());
};

Result:

_.isDate(date); // false