Registry / productivity / dt-format

dt-format

JSON →
library1.0.8jsnpmunverified

A JavaScript date formatting utility inspired by Java's SimpleDateFormat. Version 1.0.8 provides pattern-based formatting with support for common date, time, and weekday components (e.g., dd, MMMM, yyyy, hh:mm:ss, a). It includes locale-aware month and weekday names in multiple languages (English, French, German, Simplified Chinese, Russian, Arabic, Japanese). The library is lightweight with no external dependencies. Last updated in 2021, it appears to be in maintenance mode with no recent updates. Compared to alternatives like date-fns or moment.js, dt-format offers a Java-like API but lacks extensive locale data and comprehensive documentation.

npm install dt-format
INSTALL
IMPORT
SIG · DT-FORMAT
D
dt-format
productivityjavascriptv1.0.8
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.

DateTimeFormat
import { DateTimeFormat } from 'dt-format'
const DateTimeFormat = require('dt-format')
The package is ESM-only; named export, not default. CommonJS require() will fail.
DateTimeLocale
import { DateTimeLocale } from 'dt-format'
import DateTimeLocale from 'dt-format'
DateTimeLocale is a named export, not a default export.
DateFormat
import { DateTimeFormat } from 'dt-format'; const DateFormat = DateTimeFormat;
import { DateFormat } from 'dt-format'
The class is named DateTimeFormat, but the README uses DateFormat as an alias after import. No direct DateFormat export exists.

Demonstrates importing DateTimeFormat and DateTimeLocale, formatting a date with a pattern, and using a German locale.

import { DateTimeFormat, DateTimeLocale } from 'dt-format'; const pattern = 'dd/MMMM/yyyy HH:mm:ss'; const formatted = DateTimeFormat.format(new Date(), pattern); console.log(formatted); // e.g., 20/August/2025 14:30:45 // With locale const germanFormatted = DateTimeFormat.format(new Date(), 'dd/MMMM/yyyy', DateTimeLocale.de_DE); console.log(germanFormatted); // e.g., 20/August/2025
Debug
Known issues
gotchaThe class is named DateTimeFormat, but the README uses DateFormat as an alias after import — no direct DateFormat export exists.
fix
Always import DateTimeFormat as the class; do not rely on a DateFormat export.
affects: >=0.0.0
gotchaThe package is ESM-only. Attempting to require() it in CommonJS will throw an error.
fix
Use dynamic import() in CommonJS or switch to ESM imports.
affects: >=1.0.0
gotchaDefault locale is en_GB, but en_US is not explicitly supported. Weekday/month names may differ (e.g., 'September' vs 'Septembre' for French).
fix
Specify locale explicitly if needed; do not assume en_US.
affects: >=0.0.0
deprecatedPackage has not been updated since 2021, suggesting maintenance status. No compatibility with newer Node.js or browser environments guaranteed.
fix
Consider migrating to actively maintained libraries like date-fns or dayjs.
affects: >=1.0.8
Errors
Common errors & fixes
TypeError: DateTimeFormat.format is not a function
Importing DateTimeFormat as default instead of named import, e.g., import DateTimeFormat from 'dt-format'.
fix
Use named import: import { DateTimeFormat } from 'dt-format'
ReferenceError: DateFormat is not defined
Attempting to use DateFormat directly without importing or aliasing DateTimeFormat.
fix
Import DateTimeFormat and optionally assign it to var DateFormat = DateTimeFormat;
Error: Cannot find module 'dt-format' when using require
Package is ESM-only; CommonJS require() is not supported.
fix
Use dynamic import('dt-format') or switch your project to ESM.
Upgrade
Version history
1.0.8latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
25 hits · last 30 days
node
22
Amazon
1
OpenAI (training)
1
Resources
dt-format — npm install dt-format · libregistry