Registry / productivity / dateable

dateable

JSON →
library1.0.1jsnpmunverified

A lightweight date formatting and parsing library for Node.js, version 1.0.1. It provides functions to format dates using custom patterns, parse formatted strings back to Date objects, compute relative time (e.g., '4 years ago'), and calculate differences between dates. It supports localized output via language configuration. The API is minimal and synchronous, distinguishing it from heavier libraries like Moment.js. The project appears to be in maintenance mode with no recent updates.

npm install dateable
INSTALL
IMPORT
SIG · DATEABLE
D
dateable
productivityjavascriptv1.0.1
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.

dateable
import dateable from 'dateable'
const dateable = require('dateable')
The package is ESM-compatible? Actually, the README shows 'var dateable = require('dateable')' indicating CommonJS. Default import works as a function.
dateable.parse
import dateable from 'dateable'; dateable.parse(str, format)
import { parse } from 'dateable'
parse is a method on the default export, not a named export.
dateable.when
import dateable from 'dateable'; dateable.when(date)
import { when } from 'dateable'
when is a method on the default export.

Demonstrates core functions: format, parse, relative time, and difference between dates.

import dateable from 'dateable'; const date = new Date(2009, 4, 23); // Format a date const formatted = dateable(date, 'MM/DD-YYYY, hh:mm'); console.log(formatted); // => "05/23-2009, 00:00" (depends on timezone) // Parse a formatted string const parsed = dateable.parse('05/23-2009, 00:00', 'MM/DD-YYYY, hh:mm'); console.log(parsed); // => Sat May 23 2009 00:00:00 GMT+0000 (UTC) // Relative time const past = new Date(2008, 4, 20); console.log(dateable.when(past)); // => "4 years ago" (depending on current date) // Difference between two dates const start = new Date(2015, 0, 1); const end = new Date(); console.log(dateable.diff(start, end)); // => "9 years" (at time of writing)
Debug
Known issues
gotchaTime zone differences: The library outputs date parts based on local time zone of the runtime, not UTC. Formatting 'hh:mm' may shift by offset.
fix
Use UTC-oriented methods or ensure consistent time zone handling in your application.
affects: <=1.0.1
deprecatedNo maintenance since 2014; the library is not updated for modern JavaScript environments.
fix
Consider switching to maintained alternatives like date-fns or dayjs.
affects: >=1.0.0
gotchaEscape text in format requires quotes: Use single or double quotes around literal text in the format string, otherwise it will be treated as format tokens.
fix
Wrap literal text in quotes: dateable(date, "'Today is' dddd")
affects: >=1.0.0
breakingLanguage method overrides global locale; affects all subsequent calls.
fix
Set language before formatting calls, or use separate instances if available (not supported).
affects: >=1.0.0
Errors
Common errors & fixes
dateable is not a function
Importing incorrectly: { dateable } instead of default import.
fix
Use `import dateable from 'dateable'` (or `const dateable = require('dateable')` in CommonJS).
TypeError: dateable.when is not a function
Attempting to import `when` as a named export.
fix
Call `dateable.when(date)` after default import.
ReferenceError: dateable is not defined
Missing import or incorrect module path.
fix
Install package: `npm install dateable` and import correctly.
Upgrade
Version history
1.0.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
32 hits · last 30 days
node
26
Amazon
1
OpenAI (training)
1
Resources
dateable — npm install dateable · libregistry