HEX
Server: LiteSpeed
System: Linux s1296.sgp1.mysecurecloudhost.com 4.18.0-513.11.1.lve.el8.x86_64 #1 SMP Thu Jan 18 16:21:02 UTC 2024 x86_64
User: bishwesh (1878)
PHP: 7.4.33
Disabled: NONE
Upload Files
File: /home/bishwesh/internstolearn.com/node_modules/type/date/is.js
"use strict";

var isPrototype = require("../prototype/is");

var dateValueOf = Date.prototype.valueOf;

module.exports = function (value) {
	if (!value) return false;

	try {
		// Sanity check (reject objects which do not expose common Date interface)
		if (typeof value.getFullYear !== "function") return false;
		if (typeof value.getTimezoneOffset !== "function") return false;
		if (typeof value.setFullYear !== "function") return false;

		// Ensure its native Date object (has [[DateValue]] slot)
		dateValueOf.call(value);
	} catch (error) {
		return false;
	}

	// Ensure it hosts valid date
	if (isNaN(value)) return false;

	return !isPrototype(value);
};