
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
little-timestamp
Advanced tools
import { formatTimestamp } from "little-timestamp";
const today = new Date("2025-06-02T12:00:00.000Z"); // For testing purposes
const timestamp = new Date("2025-06-02T06:00:00.000Z"); // 6am
console.log(formatTimestamp(timestamp, { today })); // Outputs: "6h ago"
bun add little-timestamp
npm i little-timestamp
| Description | Output |
|---|---|
| Past | |
| <1s | Just now |
| 1-59s | "N"s ago |
| 1-59m | "N"m ago |
| 1-23h | "N"h ago |
| >24h | Jun 1 |
| >24h different year | Jun 1, 2024 |
| Future | |
| 1-59s | "N"s from now |
| 1-59m | "N"m from now |
| 1-23h | "N"h from now |
| >24h | Jun 1 |
| >24h different year | Jun 1, 2026 |
Most of the formatting behavior is opinionated and can't be changed. However, there are some options that can be used to customize the output.
import { formatTimestamp } from "little-timestamp";
// ...
formatTimestamp(timestamp, {
locale: "es-ES", // Overwrite the default date locale
today: new Date(), // Overwrite the default "today" date, useful for testing purposes
});
We welcome contributions! If you'd like to improve little-timestamp or have any feedback, feel free to open an issue or submit a pull request.
MIT
FAQs
A small & opinionated timestamp formatting library
We found that little-timestamp demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.