Registry / productivity / 3h-time

3h-time

JSON →
library1.2.1jsnpmunverified

A lightweight time formatter library (v1.2.1). Provides a simple API to format Date objects with customizable format strings. Uses a replacer map with tokens like YYYY, MM, DD, HH, etc. Includes both class method (Time.format) and convenience method (Time.get). Ships TypeScript types. Stable, no recent updates.

npm install 3h-time
INSTALL
IMPORT
SIG · 3H-TIME
3
3h-time
productivityjavascriptv1.2.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.

Time
import { Time } from '3h-time'
const Time = require('3h-time')
Package is ESM-only; require is not supported.
Time
import { Time } from '3h-time'
import Time from '3h-time'
Default export does not exist; only named export.
Time
const { Time } = await import('3h-time')
Dynamic import with named destructuring works in ESM.

Formats a Date object using common tokens and shows usage of Time.get() for current date.

import { Time } from '3h-time'; const date = new Date('2025-01-15T14:30:45'); console.log(Time.format(date, 'YYYY-MM-DD HH:mm:ss')); // '2025-01-15 14:30:45' console.log(Time.get('DD')); // '15' console.log(Time.format(date, 'MMMM D, YYYY')); // 'January 15, 2025'
Debug
Known issues
breakingPackage is ESM-only; CommonJS require fails.
fix
Use `import { Time } from '3h-time'` or dynamic import.
affects: >=1.0
gotchaNo TypeScript type definitions are exported (only implicit types).
fix
Use type inference or create your own types if needed.
affects: >=1.0
deprecatedThe `Time.replacers` property is plain object; no getter/setter protection.
fix
Avoid modifying replacers directly.
affects: >=1.0
gotchaMillisecond tokens 'sss', 'ss', 's' are not zero-padded consistently.
fix
Use 'sss' for full 3-digit milliseconds; otherwise behavior varies.
affects: >=1.0
Errors
Common errors & fixes
SyntaxError: The requested module '3h-time' does not provide an export named 'Time'
Using incorrect import path or version mismatch.
fix
Install the correct package: `npm install 3h-time` and use named import as shown.
TypeError: Time.format is not a function
Importing default export instead of named export.
fix
Use `import { Time } from '3h-time'`.
Time.format is not a function (in Node.js require)
Using require() in CommonJS environment; package is ESM-only.
fix
Switch to ESM ("type": "module" in package.json) or use dynamic import.
Error: Can't resolve '3h-time'
Package not installed or bundler misconfig.
fix
Run `npm install 3h-time` and check import path.
Upgrade
Version history
1.2.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
62 hits · last 30 days
node
56
Amazon
1
OpenAI (training)
1
Resources
3h-time — npm install 3h-time · libregistry