• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2
3var getDay = Date.prototype.getDay;
4var tryDateObject = function tryDateObject(value) {
5	try {
6		getDay.call(value);
7		return true;
8	} catch (e) {
9		return false;
10	}
11};
12
13var toStr = Object.prototype.toString;
14var dateClass = '[object Date]';
15var hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol';
16
17module.exports = function isDateObject(value) {
18	if (typeof value !== 'object' || value === null) { return false; }
19	return hasToStringTag ? tryDateObject(value) : toStr.call(value) === dateClass;
20};
21