1
0
Fork 0
management/front/dkha-web-sz-main/node_modules/is-date-object/index.js

23 lines
522 B
JavaScript
Raw Permalink Normal View History

2023-12-18 13:12:25 +08:00
'use strict';
var getDay = Date.prototype.getDay;
2023-12-28 23:41:32 +08:00
var tryDateObject = function tryDateGetDayCall(value) {
2023-12-18 13:12:25 +08:00
try {
getDay.call(value);
return true;
} catch (e) {
return false;
}
};
var toStr = Object.prototype.toString;
var dateClass = '[object Date]';
2023-12-28 23:41:32 +08:00
var hasToStringTag = require('has-tostringtag/shams')();
2023-12-18 13:12:25 +08:00
module.exports = function isDateObject(value) {
2023-12-28 23:41:32 +08:00
if (typeof value !== 'object' || value === null) {
return false;
}
2023-12-18 13:12:25 +08:00
return hasToStringTag ? tryDateObject(value) : toStr.call(value) === dateClass;
};