Socket
Socket
Sign inDemoInstall

is-date-object

Package Overview
Dependencies
0
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
23M
decreased by-25.6%
Maintainers
1
Install size
24.2 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.3 - 2021-05-05

Commits

  • [Tests] migrate tests to Github Actions 023504f
  • [readme] add actions and codecov badges e63305f
  • [meta] do not publish github action workflow files 017d906
  • [Tests] run nyc on all tests 0376b6f
  • [readme] fix repo URLs; remove defunct badges 1c148c6
  • [Dev Deps] update eslint, @ljharb/eslint-config, aud, auto-changelog, tape c7a3f54
  • [actions] add "Allow Edits" workflow e79b5b2
  • [Dev Deps] update eslint, @ljharb/eslint-config, aud, tape da28980
  • [Dev Deps] update eslint, @ljharb/eslint-config, aud, auto-changelog 5cabae9
  • [readme] add actions and codecov badges 33dfb88
  • [Dev Deps] update eslint, @ljharb/eslint-config, tape 745eb04
  • [Dev Deps] update eslint, @ljharb/eslint-config, tape 466c62b
  • [actions] use checkout v2; remove unneeded env ff87a16
  • [Dev Deps] update auto-changelog, tape 93188f5
  • [meta] use prepublishOnly script for npm 7+ 1d0e3ea
  • [actions] update workflows 4d1a235
  • [Dev Deps] update auto-changelog; add aud 67be59a
  • [actions] switch Automatic Rebase workflow to pull_request_target event a6661c2
  • [Tests] only audit prod deps dd4a47f

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 May 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