You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
646 B
JavaScript

'use strict';
/* Derived from `is-date-object 1.0.5`, under MIT license, (c) 2015 Jordan Harband.
This version removes the try/catch for performance reasons, and replaces it with a test that unfortunately does not work on cross-realm values, pending an upstream fix. */
var getDay = Date.prototype.getDay;
var toStr = Object.prototype.toString;
var dateClass = '[object Date]';
var hasToStringTag = require('has-tostringtag/shams')();
module.exports = function isDateObject(value) {
if (typeof value !== 'object' || value === null) {
return false;
}
return hasToStringTag ? value instanceof Date : toStr.call(value) === dateClass;
};