Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
is-date-object
Advanced tools
Is this value a JS Date object? This module works cross-realm/iframe, and despite ES6 @@toStringTag.
The is-date-object npm package is primarily used for checking if a given value is a Date object. It is a simple utility that can be very useful in situations where type checking is necessary, especially when working with dates in JavaScript. This package provides a straightforward and reliable way to determine if a value is an instance of a Date object.
Check if a value is a Date object
This feature allows you to check if a given value is a Date object. The function returns true if the value is a Date object, and false otherwise. This is particularly useful for validation and error handling in applications that deal with date inputs.
const isDateObject = require('is-date-object');
console.log(isDateObject(new Date())); // true
console.log(isDateObject('2020-01-01')); // false
date-fns is a comprehensive date utility library that offers a wide range of functions for parsing, validating, manipulating, and formatting dates. Unlike is-date-object, which focuses solely on checking if a value is a Date object, date-fns provides a broader set of functionalities for working with dates in JavaScript.
moment is another popular date manipulation library that offers functionalities similar to date-fns, including parsing, validation, manipulation, and formatting of dates. While moment is more feature-rich compared to is-date-object, it is also larger in size, which might be a consideration for projects concerned with bundle size.
dayjs is a lightweight date library that offers a similar API to moment. It provides a wide range of functionalities for working with dates, including parsing, validation, manipulation, and formatting. Dayjs is a good alternative to is-date-object for projects that require more comprehensive date handling capabilities but still want to keep their bundle size small.
Is this value a JS Date object? This module works cross-realm/iframe, and despite ES6 @@toStringTag.
var isDate = require('is-date-object');
var assert = require('assert');
assert.notOk(isDate(undefined));
assert.notOk(isDate(null));
assert.notOk(isDate(false));
assert.notOk(isDate(true));
assert.notOk(isDate(42));
assert.notOk(isDate('foo'));
assert.notOk(isDate(function () {}));
assert.notOk(isDate([]));
assert.notOk(isDate({}));
assert.notOk(isDate(/a/g));
assert.notOk(isDate(new RegExp('a', 'g')));
assert.ok(isDate(new Date()));
Simply clone the repo, npm install
, and run npm test
v1.1.0 - 2024-12-12
35c5af0
npmignore
to autogenerate an npmignore file db6113c
4f1d9b3
c9a1e4f
eslint
, @ljharb/eslint-config
, core-js
, safe-publish-latest
, tape
35a2864
eslint
, @ljharb/eslint-config
, aud
, auto-changelog
, tape
b670bca
d6bb341
f850678
call-bound
18ed326
@ljharb/eslint-config
, auto-changelog
, core-js
, npmignore
, tape
f0e792f
exports
field 342351f
aud
with npm audit
9b9b9cf
has-tostringtag
1bc37ab
sideEffects
flag 86d3a16
fee274d
FAQs
Is this value a JS Date object? This module works cross-realm/iframe, and despite ES6 @@toStringTag.
The npm package is-date-object receives a total of 11,929,000 weekly downloads. As such, is-date-object popularity was classified as popular.
We found that is-date-object demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.