• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# is-date-object <sup>[![Version Badge][2]][1]</sup>
2
3[![Build Status][3]][4]
4[![dependency status][5]][6]
5[![dev dependency status][7]][8]
6[![License][license-image]][license-url]
7[![Downloads][downloads-image]][downloads-url]
8
9[![npm badge][11]][1]
10
11[![browser support][9]][10]
12
13Is this value a JS Date object? This module works cross-realm/iframe, and despite ES6 @@toStringTag.
14
15## Example
16
17```js
18var isDate = require('is-date-object');
19var assert = require('assert');
20
21assert.notOk(isDate(undefined));
22assert.notOk(isDate(null));
23assert.notOk(isDate(false));
24assert.notOk(isDate(true));
25assert.notOk(isDate(42));
26assert.notOk(isDate('foo'));
27assert.notOk(isDate(function () {}));
28assert.notOk(isDate([]));
29assert.notOk(isDate({}));
30assert.notOk(isDate(/a/g));
31assert.notOk(isDate(new RegExp('a', 'g')));
32
33assert.ok(isDate(new Date()));
34```
35
36## Tests
37Simply clone the repo, `npm install`, and run `npm test`
38
39[1]: https://npmjs.org/package/is-date-object
40[2]: http://versionbadg.es/ljharb/is-date-object.svg
41[3]: https://travis-ci.org/ljharb/is-date-object.svg
42[4]: https://travis-ci.org/ljharb/is-date-object
43[5]: https://david-dm.org/ljharb/is-date-object.svg
44[6]: https://david-dm.org/ljharb/is-date-object
45[7]: https://david-dm.org/ljharb/is-date-object/dev-status.svg
46[8]: https://david-dm.org/ljharb/is-date-object#info=devDependencies
47[9]: https://ci.testling.com/ljharb/is-date-object.png
48[10]: https://ci.testling.com/ljharb/is-date-object
49[11]: https://nodei.co/npm/is-date-object.png?downloads=true&stars=true
50[license-image]: http://img.shields.io/npm/l/is-date-object.svg
51[license-url]: LICENSE
52[downloads-image]: http://img.shields.io/npm/dm/is-date-object.svg
53[downloads-url]: http://npm-stat.com/charts.html?package=is-date-object
54