
Research
/Security News
Intercom’s npm Package Compromised in Ongoing Mini Shai-Hulud Worm Attack
Compromised intercom-client@7.0.4 npm package is tied to the ongoing Mini Shai-Hulud worm attack targeting developer and CI/CD secrets.
A tiny (339B) utility for human-readable time differences between now and past or future dates.
A tiny (339B) utility for human-readable time differences between now and past or future dates.
$ npm install fromnow --save
A valid date string is the only required parameter.
const fromNow = require('fromnow');
fromNow('12/31/2010');
//=> "4 years, 10 months, 8 days, 10 hours, 15 minutes"
fromNow('2030-05-20');
//=> "14 years, 6 months, 21 days, 5 hours, 43 minutes"
fromNow('2030-05-20 14:02:47');
//=> "14 years, 6 months, 22 days, 2 hours, 44 minutes"
fromNow('Wed, 20 Nov 1912 00:00:00 GMT');
//=> "103 years, 23 days, 18 hours, 20 minutes"
Returns: String
A valid date string is the only required parameter.
Type: String
You may pass it any valid date string.
Type: Integer
Default: null
If set, will limits the return to display a maximum number of non-null segments.
Important: When
opts.zero = truethen empty segments will count towards yourmaxlimit!
// zero=true
"2 years, 0 months, 12 hours, 57 minutes"
// zero=true; max=2
"2 years, 0 months"
// zero=false
"2 years, 12 hours, 57 minutes"
// zero=false; max=2
"2 years, 12 hours"
Type: Boolean
Default: false
Appends "ago" or "from now" to the output.
// NOW = "Sun Jun 14 2015 15:12:05"
fromNow("Sun Jun 14 2015 14:09:05", { and:true, suffix:true });
//=> "1 hour and 3 minutes ago"
fromNow("Sun Jun 14 2017 14:09:05", { and:true, suffix:true, max:2 });
//=> "2 years and 10 days from now"
Type: Boolean
Default: false
Join the last two segments with " and ".
"1 year, 4 hours, 16 minutes"
//=> "1 year, 4 hours, and 16 minutes"
"2 days, 12 hours"
//=> "2 days and 12 hours"
Type: Boolean
Default: false
Return segments with 0 value.
// NOW = "Sun Jun 14 2015 15:12:05"
fromNow("Sun Jun 14 2015 15:14:05");
//=> "2 minutes"
fromNow("Sun Jun 14 2015 15:14:05", { zero:true });
//=> "0 years, 0 months, 0 days, 0 hours, 2 minutes"
fromNow('12/31/2010', { max:3 });
//=> "4 years, 10 months, 8 days"
fromNow('2030-05-20', { max:2 });
//=> "14 years, 6 months"
fromNow('12/31/2010', { max:3, suffix:true });
//=> "4 years, 10 months, 8 days ago"
fromNow('12/31/2030', { max:1, suffix:true });
//=> "12 years from now"
fromNow('12/31/2010', { max:3, suffix:true, and:true });
//=> "4 years, 10 months, and 8 days ago"
fromNow('Wed, 20 Nov 1912 00:00:00 GMT', { max:2, suffix:true, and:true });
//=> "103 years and 23 days ago"
// Will only apply on 2+ segments
fromNow('2030-05-20', { max:1, and:true });
//=> "14 years"
MIT © Luke Edwards
FAQs
A tiny (339B) utility for human-readable time differences between now and past or future dates.
The npm package fromnow receives a total of 1,796 weekly downloads. As such, fromnow popularity was classified as popular.
We found that fromnow 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.

Research
/Security News
Compromised intercom-client@7.0.4 npm package is tied to the ongoing Mini Shai-Hulud worm attack targeting developer and CI/CD secrets.

Research
Socket detected a malicious supply chain attack on PyPI package lightning versions 2.6.2 and 2.6.3, which execute credential-stealing malware on import.

Research
A brand-squatted TanStack npm package used postinstall scripts to steal .env files and exfiltrate developer secrets to an attacker-controlled endpoint.