Registry / productivity / az-time-formatter

az-time-formatter

JSON →
library1.9.2jsnpmunverified

Az-time-formatter is a lightweight JavaScript library for formatting and parsing dates and times with support for multiple locales and timezones. Version 1.9.2 is stable, with monthly releases on npm. It offers a fluent API for common date operations, includes TypeScript type definitions, and is distributed as an ESM module with CommonJS fallback. Key differentiators include zero dependencies and built-in localization for over 20 locales.

npm install az-time-formatter
INSTALL
IMPORT
SIG · AZ-TIME-FORMATTER
A
az-time-formatter
productivityjavascriptv1.9.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.

formatDate
import { formatDate } from 'az-time-formatter'
const formatDate = require('az-time-formatter').formatDate
Esm-only since v2; require() usage may cause issues in Node < 16
parseDate
import { parseDate } from 'az-time-formatter'
import parseDate from 'az-time-formatter'
Named export, not default; use named import syntax
DateTimeFormatter
import { DateTimeFormatter } from 'az-time-formatter'
Class-based API for advanced formatting; always use named import

Demonstrates basic date formatting and parsing with locale and timezone options in TypeScript.

import { formatDate, parseDate } from 'az-time-formatter'; // Format current date const formatted = formatDate(new Date(), 'yyyy-MM-dd', { locale: 'en-US', timezone: 'UTC' }); console.log(formatted); // e.g., '2025-04-10' // Parse a date string const parsed = parseDate('2025-04-10', 'yyyy-MM-dd', { locale: 'en-US', timezone: 'UTC' }); console.log(parsed instanceof Date); // true
Debug
Known issues
breakingVersion 2.0 dropped CommonJS support; only ESM is available.
fix
Use import syntax instead of require, or stay on v1 if CJS is required.
affects: >=2.0
breakingIn v1.9.0, the signature of formatDate changed from (date, pattern) to (date, pattern, options) with required third argument.
fix
Update calls to include options object with locale and timezone.
affects: >=1.9.0
deprecatedThe function 'format' has been deprecated in favor of 'formatDate' since v1.5.0.
fix
Replace format() with formatDate().
affects: >=1.5.0
gotchaTimezone defaults to UTC if not specified in options; unexpected results if local time assumed.
fix
Always pass options.timezone explicitly when parsing or formatting.
affects: all
gotchaLocale data is not tree-shaken; importing many locales may increase bundle size.
fix
Use dynamic import with specific locale modules if available, or bundle only needed locales.
affects: all
Errors
Common errors & fixes
Error: Cannot find module 'az-time-formatter'
Package not installed or wrong environment (CJS vs ESM).
fix
Install with npm install az-time-formatter; ensure project supports ESM ("type": "module" in package.json or use .mjs extension).
TypeError: formatDate is not a function
Incorrect import (default import used for named export).
fix
Use import { formatDate } from 'az-time-formatter' instead of importing as default.
Error: Pattern must be a string
Passing non-string pattern to formatDate/parseDate.
fix
Ensure pattern argument is a string (e.g., 'yyyy-MM-dd').
Upgrade
Version history
1.9.2latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
16 hits · last 30 days
node
14
OpenAI (training)
1
Resources
az-time-formatter — npm install az-time-formatter · libregistry