
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.
epoch-timeago
Advanced tools
Convert Unix time to a relative time string e.g., "4 hours ago".
As the name implies, only epoch time (Unix time) can be used. The output format is similar to what you would find on Reddit.
There is zero configuration. Zero dependencies. Minifies to 435 bytes, and gzips to 224 bytes. 😎
yarn add epoch-timeago
or
npm install -S epoch-timeago
The default build selected will depend on your bundle tool configuration. By default webpack will get the UMD build, and Rollup the esm build. If you want to override this use the following paths:
'epoch-timeago/dist','epoch-timeago/lib','epoch-timeago/es'.'epoch-timeago/src'.NOTE: Builds are all minified.
Simply pass a Unix time stamp converted to milliseconds (timestampInSeconds * 1000) and get a time ago formatted string. If your timestamps are in milliseconds no conversion is necessary.
import timeago from 'epoch-timeago';
// Example of simple usage
const timeDiff = timeago(timestamp * 1000)
//Example of formatted string
const timeSince = timeago(Date.now() - 60000 * 10);
// '10 minutes ago'
import React from 'react';
import timeago from 'epoch-timeago';
const TimeAgo = ({ time }) =>
<time datetime={new Date(time).toISOString()}>{timeago(time)}</time>
// ...
const epochTimeStamp = Date.now() - 60000 * 22;
<TimeAgo time={epochTimeStamp} />
MIT
FAQs
Convert Unix time to a relative time string e.g., "4 hours ago".
We found that epoch-timeago demonstrated a not healthy version release cadence and project activity because the last version was released 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.