Package detail

date

es-shims12.2kMIT2.0.6

ES spec-compliant Date shim/polyfill/replacement that works as far down as ES3

shim, polyfill, javascript, ecmascript

readme

date Version Badge

github actions coverage dependency status dev dependency status License Downloads

npm badge

ES spec-compliant shim for Date. Invoke its "shim" method to shim Date if it is unavailable or noncompliant.

This package implements the es-shim API “multi” interface, v3. It works in an ES3-supported environment, and complies with the spec.

Most common usage:

var assert = require('assert');

var shims = require('date');

assert.deepEqual(shims, [
    'Date',
    'Date.prototype.getFullYear',
    'Date.prototype.getMonth',
    'Date.prototype.getDate',
    'Date.prototype.getUTCDate',
    'Date.prototype.getUTCFullYear',
    'Date.prototype.getUTCMonth',
    'Date.prototype.toUTCString',
    'Date.prototype.toDateString',
    'Date.prototype.toString',
    'Date.prototype.toISOString',
    'Date.prototype.toJSON',
    'Date.now',
    'Date.parse',
]);

require('date/auto'); // will be a no-op if not needed

assert.ok(new Date() instanceof Date);
assert.equal(typeof Date.now(), 'number');

// etc, with all the Date methods you expect

Tests

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

changelog

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog and this project adheres to Semantic Versioning.

v2.0.6 - 2024-12-21

Commits

  • [actions] split out node 10-20, and 20+ 546c630
  • [Refactor] use call-bound, math-intrinsics directly 1968c3f
  • [Deps] update call-bind, es-abstract, get-intrinsic, safe-regex-test a85fc9e
  • [Dev Deps] update @es-shims/api, @ljharb/eslint-config, auto-changelog, object-inspect, tape 3bc01f1
  • [Dev Deps] update @es-shims/api, array.prototype.map, function.prototype.name, object-inspect d62d072
  • [Dev Deps] update to v3 of es-shims API c841e93
  • [Deps] update es-abstract, globalthis 713df00
  • [Tests] replace aud with npm audit 99f3c45
  • [Dev Deps] remove unused deps 9bb56bf
  • [Tests] add debug info 06afe63
  • [Dev Deps] add missing peer dep f4b048d

v2.0.5 - 2024-03-23

Commits

  • [Deps] update call-bind, es-abstract, es-errors, get-intrinsic, safe-regex-test e907103
  • [actions] remove redundant finisher 0b526d5
  • [meta] add missing entrypoints to exports bca3319
  • [Dev Deps] update array.prototype.map, has-property-descriptors, tape d6b9c16

v2.0.4 - 2024-02-04

Commits

  • [Refactor] use es-errors where possible, so things that only need those do not need get-intrinsic 5be64f8
  • [Dev Deps] update array.prototype.map, aud, has-property-descriptors, npmignore, object-inspect, tape 41418aa
  • [Deps] update call-bind, define-properties, es-abstract, get-intrinsic, safe-regex-test 90e2249

v2.0.3 - 2023-08-29

Commits

  • [Deps] update define-properties, es-abstract, get-intrinsic 7db1731
  • [Dev Deps] update @es-shims/api, @ljharb/eslint-config, aud, es6-shim, function.prototype.name, object-inspect, tape 229ee1f

v2.0.2 - 2022-11-03

Commits

  • [Deps] update es-abstract fb1349f
  • [actions] update rebase action to use reusable workflow 043123b
  • [Dev Deps] update array.prototype.map 8aa2887

v2.0.1 - 2022-09-22

Commits

  • [Refactor] use safe-regex-test 0df6d6f
  • [Dev Deps] update aud, object-inspect, tape 3b8c35e
  • [Deps] update es-abstract, get-intrinsic 37defbc

v2.0.0 - 2022-05-23

Commits

v1.0.2 - 2014-08-29

Commits

  • scratch file 34740d6
  • republished for ender.js (removed require-kiss) fbcfdce
  • Fixed typo in author url 0cdf3df

v1.0.1 - 2011-03-30

Commits