
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.
Compare two dates and report the distance in user friendly years, months, weeks, days, hours, and seconds.
A single purpose javascript module that compares two dates and reports the distance in user friendly years, months, weeks, days, hours, and seconds.
Date objectnew Date()Basic usage:
const { unit, value, string, past } = timeUntil(date)
console.log('Unit', unit) // /(now)|((second|minute|hour|day|week|month|year)s?)/
console.log('Value', value) // /(d+)/
console.log('String', string) // 10 weeks ago, 5 days time, 2 hours, 1 minute ago, now
console.log('Past', past) // true|false
Calling timeUntil(date) returns an object; the .string property can be displayed straight the user, but if you want the break down, then the .unit, .value, and .past / future status is available as well.
If assuming now as being Sun Feb 12 2017 23:08:56 GMT:
Time Until
No change
√ should interpret 'Sun, 12 Feb 2017 23:08:56 GMT' as now
Seconds
√ should interpret 'Sun, 12 Feb 2017 23:09:01 GMT' as 5 seconds
√ should interpret 'Sun, 12 Feb 2017 23:09:58 GMT' as 62 seconds
Minutes
√ should interpret 'Sun, 12 Feb 2017 23:13:56 GMT' as 5 minutes
√ should interpret 'Sun, 13 Feb 2017 01:07:56 GMT' as 119 minutes
Hours
√ should interpret 'Sun, 13 Feb 2017 04:08:56 GMT' as 5 hours
√ should interpret 'Sun, 14 Feb 2017 22:08:56 GMT' as 47 hours
Days
√ should interpret 'Sun, 17 Feb 2017 23:08:56 GMT' as 5 days
√ should interpret 'Sun, 20 Feb 2017 23:08:56 GMT' as 8 days
√ should interpret 'Sun, 04 Mar 2017 23:08:56 GMT' as 20 days
Weeks
√ should interpret 'Sun, 05 Mar 2017 23:08:56 GMT' as 3 weeks
√ should interpret 'Sun, 12 Mar 2017 23:08:56 GMT' as 4 weeks
√ should interpret 'Sun, 22 Mar 2017 23:08:56 GMT' as 5 weeks
√ should interpret 'Sun, 12 Apr 2017 23:08:56 GMT' as 8 weeks
Months
√ should interpret 'Sun, 22 May 2017 23:08:56 GMT' as 3 months
√ should interpret 'Sun, 12 Jul 2017 23:08:56 GMT' as 5 months
√ should interpret 'Sun, 12 Feb 2018 23:08:56 GMT' as 12 months
√ should interpret 'Sun, 12 Jan 2019 23:08:56 GMT' as 23 months
√ should interpret 'Sun, 12 Feb 2019 23:08:56 GMT' as 24 months
Years
√ should interpret 'Sun, 13 Feb 2019 23:08:56 GMT' as 2 years
√ should interpret 'Sun, 13 Feb 2022 23:08:56 GMT' as 5 years
As a node module, use npm install time-until to bring the module into your repository, and then require the module into your code:
const timeUntil = require('time-until')
const dateToCheck = Date.parse('Sun, 17 Feb 2017 23:08:56 GMT')
console.log(timeUntil(dateToCheck), 'until', dateToCheck)
For use on a web page, include time-until.js into your project using a script tag, for example:
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="js/time-until.js"></script>
</head>
<body>
...
<script>
const dateToCheck = Date.parse('Sun, 17 Feb 2017 23:08:56 GMT')
document.write(window.timeUntil(dateToCheck) + ' until ' + dateToCheck)
</script>
</body>
</html>
This project uses nodejs and mocha for testing. The project uses standard for linting.
To run the tests locally, checkout this repo using git, then run:
npm install
npm test
FAQs
Compare two dates and report the distance in user friendly years, months, weeks, days, hours, and seconds.
We found that time-until 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.