The `year` package is a simple JavaScript utility designed to retrieve the current year, formatted as either two or four digits. Its primary function is to return `YYYY` by default or `YY` when explicitly requested. The current version, 0.2.1, was last updated in 2014, making it effectively abandoned and unmaintained. As such, there is no active release cadence, and it lacks support for modern JavaScript features like ESM. It differentiates itself through its extreme simplicity and minimal footprint, although modern alternatives offer more robust date formatting and are actively maintained. It targets Node.js environments version 0.8 and above, reflecting its age.
npm install yearVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to import the `year` utility and use it to get the current year in both two-digit and four-digit formats.
Replace `year()` calls with `new Date().getFullYear()` and `String(new Date().getFullYear()).slice(-2)` for two-digit formatting.
Ensure your project is configured for CommonJS, or use dynamic `import()` if absolutely necessary within an ESM context, though direct date manipulation is preferred.
Migrate to standard JavaScript `Date` object methods or a actively maintained date utility library.
This package is CommonJS. If your project is ESM, either switch to `new Date().getFullYear()` directly, or convert your module to CommonJS. Do not use `import year from 'year';`
Ensure the CommonJS `const year = require('year');` syntax is used correctly. Verify the package is installed.No dependency data recorded yet.