
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.
pretty-date
Advanced tools
format old JavaScript dates in a “pretty” way. ex : 2 hours ago , 3 minutes ago
format old JavaScript dates in a “pretty” way. ex : 2 hours ago , 3 minutes ago
inspired by the John Resig Pretty Date plugin for jQuery (http://ejohn.org/blog/javascript-pretty-date/)
npm install pretty-date
var prettydate = require("pretty-date");
console.log(prettydate.format(new Date("Fri Aug 23 2013 17:30:34 GMT+0200 (EET)")));
var prettydate = require("pretty-date");
console.log( prettydate.format( new Date()));
console.log( prettydate.format( new Date( new Date() - 1*1000 )));
console.log( prettydate.format( new Date( new Date() - 2*1000 )));
console.log( prettydate.format( new Date( new Date() - 60*1000 )));
console.log( prettydate.format( new Date( new Date() - 2*60*1000 )));
console.log( prettydate.format( new Date( new Date() - 60*60*1000 )));
console.log( prettydate.format( new Date( new Date() - 2*60*60*1000 )));
console.log( prettydate.format( new Date( new Date() - 24*60*60*1000 )));
console.log( prettydate.format( new Date( new Date() - 2*24*60*60*1000 )));
console.log( prettydate.format( new Date( new Date() - 30*24*60*60*1000 )));
console.log( prettydate.format( new Date( new Date() - 2*30*24*60*60*1000 )));
console.log( prettydate.format( new Date( new Date() - 365*24*60*60*1000 )));
console.log( prettydate.format( new Date( new Date() - 2*365*24*60*60*1000 )));
/* outputs
* just now
* 1 second ago
* 2 seconds ago
* 1 minute ago
* 2 minutes ago
* 1 hour ago
* 2 hours ago
* yesterday
* 2 days ago
* 1 month ago
* 2 months ago
* 1 year ago
* 2 years ago
*/
feel free to fork and add features , fix bugs and your pull reguest is more than welcome
FAQs
format old JavaScript dates in a “pretty” way. ex : 2 hours ago , 3 minutes ago
We found that pretty-date 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.