Registry / devops / node.date-time

node.date-time

JSON →
library1.2.2jsnpmunverified

A lightweight JavaScript date formatting library that extends Date.prototype.format and provides a standalone formatter function. Current stable version is 1.2.2; no active release cadence observed—last updated in 2016. Key differentiators include a compact API, support for both CJS and browser script inclusion, and simple format tokens similar to PHP date. However, it is unmaintained and lacks TypeScript definitions, ESM support, and timezone handling beyond UTC.

npm install node.date-time
INSTALL
IMPORT
SIG · NODE.DATE-TIME
N
node.date-time
devopsjavascriptv1.2.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default (require)
const format = require('node.date-time');
import format from 'node.date-time';
Package uses CommonJS; no named or default ESM export. Use require() in Node.
format (standalone)
format('Y-M-d', new Date());
format.format('Y-M-d', new Date());
Direct invocation of the require result is the format function.
Date.prototype.format
new Date().format('Y-M-d');
Date.format('Y-M-d');
Prototype method available after require; invoked on Date instances, not the Date constructor.

Demonstrates standalone format function and Date.prototype.format usage with format tokens and UTC flag.

const format = require('node.date-time'); // Standalone usage: console.log(format('Y-MM-dd HH:mm:SS', new Date())); // e.g., '2016-05-18 15:45:08' // As prototype method: const d = new Date('2016-05-18T15:45:08'); console.log(d.format('Y-M-d H:m:s')); // e.g., '2016-5-18 15:45:8' // With UTC flag: console.log(format('Y-MM-dd HH:mm:SS', new Date(), true));
Debug
Known issues
deprecatedPackage is unmaintained since 2016. No updates for security or compatibility.
fix
Migrate to a modern alternative like date-fns, dayjs, or luxon.
affects: <=1.2.2
gotchaFormat tokens are non-standard and differ from common libraries. 'Y' is full year, 'y' is two-digit year; 'D' is day of week (0-6).
fix
Refer to documentation for token mapping; consider using ISO 8601 or well-known formats.
affects: >=0
gotchaNo TypeScript definitions available; using with TypeScript requires custom declaration or @ts-ignore.
fix
Add declare module 'node.date-time' or switch to typed library.
affects: >=0
breakingRequiring the module mutates Date.prototype globally, which may conflict with other libraries.
fix
Use standalone format function to avoid prototype pollution or isolate the require.
affects: >=0
Errors
Common errors & fixes
TypeError: format is not a function
Using import instead of require in Node CommonJS environment.
fix
Use const format = require('node.date-time'); instead of import.
TypeError: (intermediate value).format is not a function
Trying to call Date.format() directly instead of on an instance.
fix
Call new Date().format() not Date.format().
error TS2307: Cannot find module 'node.date-time'
Missing type declarations for the package.
fix
Add a declaration file: declare module 'node.date-time' { function format(fmt: string, date?: Date, utc?: boolean): string; export = format; }
Upgrade
Version history
1.2.2latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
node.date-time — npm install node.date-time · libregistry