A JavaScript/TypeScript library for formatting Unix timestamps and date strings into human-readable relative and locale-aware formats. Version 1.2.8 is current, with moderate release cadence. Key differentiators: supports relative time like 'About 2 days ago', locale-aware date/time formatting via Intl.DateTimeFormat, and includes both a function (unixFormatter) and a class (DateFormatter) for different use cases. Works in Node.js and browsers, with built-in TypeScript declarations. Alternative to libraries like moment.js and date-fns but more lightweight and focused on Unix timestamp formatting.
npm install unix-date-formatterNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows both library functions: relative time formatting and locale-aware date/time formatting.
Ensure the timestamp is in seconds. If you have milliseconds, divide by 1000 before passing.
Use the correct subpath imports as shown in documentation. Avoid importing from the root.
Pass a date string (e.g., '2024-03-11T01:31:29.938Z') to DateFormatter, not a Unix number.
Change import to import { unixFormatter } from 'unix-date-formatter/unix';Convert milliseconds to seconds by dividing by 1000: unixFormatter(timestamp / 1000)
No dependency data recorded yet.