
Product
Introducing the Alert Details Page: A Better Way to Explore Alerts
Socket's new Alert Details page is designed to surface more context, with a clearer layout, reachability dependency chains, and structured review.
relative-date-component
Advanced tools
Relative dates in words
$ component install component/relative-date
var date = new Date(Date.now() - 60000);
console.log(relative(date) + ' ago');
// => "one minute ago"
var date = new Date(Date.now() + 5 * 60000);
console.log(relative(date) + ' from now');
// => "5 minutes from now"
Return the date in words relative to Date.now():
var relative = require('relative-date');
var date = new Date(Date.now() + 2000);
var str = relative(date) + ' ago';
// => "2 seconds ago"
An empty string "" is returned when the difference
is below one second. You may use this to default
the string as shown here:
var str = relative(new Date) || 'just now';
// => "just now"
var str = relative(new Date);
if (str) str = 'assignment due in ' + str;
else str = 'assignment due';
// => "assignment due"
Same as above, relative to other instead of Date.now().
MIT
FAQs
Relative date in words
The npm package relative-date-component receives a total of 2 weekly downloads. As such, relative-date-component popularity was classified as not popular.
We found that relative-date-component 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.

Product
Socket's new Alert Details page is designed to surface more context, with a clearer layout, reachability dependency chains, and structured review.

Product
Campaign-level threat intelligence in Socket now shows when active supply chain attacks affect your repositories and packages.

Research
Malicious PyPI package sympy-dev targets SymPy users, a Python symbolic math library with 85 million monthly downloads.