Socket
Socket
Sign inDemoInstall

is-date-object

Package Overview
Dependencies
2
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    is-date-object

Is this value a JS Date object? This module works cross-realm/iframe, and despite ES6 @@toStringTag.


Version published
Weekly downloads
31M
decreased by-1.06%
Maintainers
1
Install size
51.8 kB
Created
Weekly downloads
 

Package description

What is is-date-object?

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.

What are is-date-object's main functionalities?

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

Other packages similar to is-date-object

Changelog

Source

v1.0.5 - 2021-08-05

Commits

  • [meta] remove .jscs.json 31c731c
  • [Fix] use has-tostringtag to behave correctly in the presence of symbol shams 17a6df4
  • [Dev Deps] update eslint, auto-changelog, tape 79db3af

Readme

Source

is-date-object Version Badge

github actions coverage dependency status dev dependency status License Downloads

npm badge

Is this value a JS Date object? This module works cross-realm/iframe, and despite ES6 @@toStringTag.

Example

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()));

Tests

Simply clone the repo, npm install, and run npm test

Keywords

FAQs

Last updated on 05 Aug 2021

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc