npm install date

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

About date

The npm package "date" serves as an essential tool for developers looking to manage and manipulate date and time values in JavaScript applications. It is designed to be a robust ES spec-compliant Date shim/polyfill/replacement that functions effectively in environments as old as ES3. This compatibility feature ensures that applications using older versions of ECMAScript can still benefit from modern date handling functionalities, making the "date" package extremely valuable for maintaining and upgrading legacy systems. By providing a consistent and reliable way to handle date and time, this package helps developers avoid common pitfalls associated with JavaScript date operations, such as timezone issues and leap year calculations.

To integrate this functionality into your project, the command "npm install date" can be used. This simple installation process adds the package to your project, allowing you to leverage its features immediately. Once installed, the "date" module can be easily required in any JavaScript file, giving you access to a plethora of methods designed to enhance and simplify the manipulation of date objects. The ease of installation and immediate availability of advanced date handling methods makes it a go-to choice for developers needing reliable date and time manipulation in their applications.

The "date" npm package not only enhances application development through its comprehensive date handling features but also supports robust development practices with its well-maintained codebase. It boasts a high coverage rate as indicated by its codecov integration, which reflects the thorough testing that the package has undergone to ensure its reliability and performance. Additionally, the package is kept up-to-date with regular updates and maintenance, ensuring compatibility with the latest JavaScript standards and features. This commitment to quality and performance makes the "date" package an indispensable tool for developers focused on creating robust, future-proof applications.

More from es-shims

es-shims npm packages

Find the best node modules for your project.

Search npm

regexp.prototype.flags

ES6 spec-compliant RegExp.prototype.flags shim...

Read more
,

string.prototype.trimend

ES2019 spec-compliant String.prototype.trimEnd shim...

Read more
,

string.prototype.trimstart

ES2019 spec-compliant String.prototype.trimStart shim...

Read more
,

arraybuffer.prototype.slice

ES spec-compliant shim for ArrayBuffer.prototype...

Read more
,

string.prototype.matchall

Spec-compliant polyfill for String.prototype...

Read more
,

object.groupby

An ESnext spec-compliant `Object.groupBy` shim/polyfill/replacement that works as far down as ES3...

Read more
,

array.prototype.tosorted

An ESnext spec-compliant `Array.prototype...

Read more
,

es-iterator-helpers

An ESnext spec-compliant iterator helpers shim/polyfill/replacement that works as far down as ES3...

Read more
,

array.prototype.toreversed

An ESnext spec-compliant `Array.prototype...

Read more
,

typedarray.prototype.slice

ES spec-compliant shim for TypedArray.prototype...

Read more
,

string.prototype.replaceall

Spec-compliant polyfill for String.prototype...

Read more
,

error-cause

An ES-spec-compliant shim/polyfill/replacement for the `...

Read more

Dependencies

Core dependencies of this npm package and its dev dependencies.

call-bind, define-properties, es-abstract, es-errors, get-intrinsic, globalthis, safe-regex-test, @es-shims/api, @ljharb/eslint-config, array.prototype.map, aud, auto-changelog, es6-shim, eslint, evalmd, for-each, function.prototype.name, has-property-descriptors, has-strict-mode, in-publish, npmignore, nyc, object-inspect, safe-publish-latest, tape

Documentation

A README file for the date code repository. View Code

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