diff --git a/lib/util.js b/lib/util.js index 1a041906db3..f47e39fddda 100644 --- a/lib/util.js +++ b/lib/util.js @@ -332,11 +332,8 @@ function isRegExp(re) { function isDate(d) { - if (d instanceof Date) return true; - if (typeof d !== 'object') return false; - var properties = Date.prototype && Object.getOwnPropertyNames(Date.prototype); - var proto = d.__proto__ && Object.getOwnPropertyNames(d.__proto__); - return JSON.stringify(proto) === JSON.stringify(properties); + return d instanceof Date || + (typeof d === 'object' && Object.prototype.toString.call(d) === '[object Date]'); }