ES spec-compliant `Date` shim/polyfill/replacement that works as far down as ES3
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.
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
A README file for the date code repository. View Code
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
Simply clone the repo, npm install
, and run npm test