Registry / productivity / cf-formatter

cf-formatter

JSON →
library1.0.2jsnpmunverified

A date and time formatter for cf (Clock Limited) projects, built on moment.js. Current stable version 1.0.2 provides locale-aware formatting via clock locales, special formats (calendar, relative time), custom format definitions, and timezone overrides at the format level. Limited to date/time; currency mentioned as potential future addition. Low release cadence; no updates since initial publish.

npm install cf-formatter
INSTALL
IMPORT
SIG · CF-FORMATTER
C
cf-formatter
productivityjavascriptv1.0.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
import formatter from 'cf-formatter'
const formatter = require('cf-formatter')
Package is CommonJS only; ESM import may require bundler or dynamic import().

Shows how to require the package, configure locale and custom formats, and use built-in locale formats, special formats, custom formats, and timezone overrides.

const formatter = require('cf-formatter'); const config = { locale: { L: 'D MMM YYYY', LTS: 'HH:mm:ss', LLL: 'D MMMM YYYY HH:mm', }, formats: { iso: 'YYYY-MM-DDTHH:mm:ss.SSSS\\Z', isoFileSystem: 'YYYYMMDD\\THHmmss\\Z', } }; const format = formatter(config); console.log(format(new Date(), 'L')); console.log(format(new Date(), 'calendar')); console.log(format(new Date(), 'from')); console.log(format(new Date(), 'iso')); console.log(format(new Date(), 'timezone', 'America/New_York'));
Debug
Known issues
gotchaPackage depends on moment.js (v2.x) which is in maintenance mode and not recommended for new projects.
fix
Consider using alternatives like date-fns or dayjs; or pin moment version if necessary.
affects: >=1.0.0
breakingThe 'calendar' and 'from' special formats rely on moment's relative time and calendar functions; behavior may differ if moment versions change.
fix
Test with target moment version; consider specifying moment peer dependency version range.
affects: >=1.0.0
deprecatedRequires Node.js v0.10 or older; not tested with modern Node.js versions and may have compatibility issues.
fix
Upgrade to Node.js LTS; if issues arise, consider using an alternative library.
affects: >=1.0.0
Errors
Common errors & fixes
Cannot find module 'moment'
Missing moment.js dependency; it is a peer dependency not installed automatically.
fix
npm install moment --save
TypeError: formatter(...) is not a function
The default export is a function that expects a configuration object. If called without arguments, it returns undefined.
fix
const format = formatter({ locale: {...}, formats: {...} });
Upgrade
Version history
1.0.2latest on npm
Audit
Dependencies
momentrequiredPrimary dependency for date manipulation and formatting.
Agent activity
30 hits · last 30 days
node
28
OpenAI (training)
1
Resources
cf-formatter — npm install cf-formatter · libregistry