Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
EasyDate is a Javascript extension for easy dates manipulations which is heavily inspired by Rails ActiveSupport::Duration class.
EasyDate is a Javascript extension for easy dates manipulations which was heavily inspired by Rails ActiveSupport::Duration class.
Node.js npm install easy-date
Bower bower install easy-date
Node.js
require('easy-date');
In Browser
<script src="easy-date.js"></script>
Quickstart usage:
by adding the codes above, new methods are now available on all numbers:
var date1 = 3..days().fromNow();
var date2 = (10).months().ago();
var yesterday = 1..day().ago();
var today = new Date();
var num = 5;
num.years().before(today); //==> is equal to 5..years().ago()
num.years().since(today); //==> is equal to 5..years().fromNow()
it will also add some basic date helpers
Date.today() //=> new Date()
Date.yesterday() //=> 1..day().ago()
Date.tommorrow() //=> 1..day().fromNow()
The date.format library written by Steven Levithan (http://blog.stevenlevithan.com/archives/date-time-format) is now integrated for a very nice date formatting.
5..days().fromNow().format("d mmmm yyyy");
// is same as
5..days().fromNow("d mmmm yyyy");
// other functions
Date.today("yyyy-mm-dd");
Date.yesterday("dddd");
3..days().since(Date.yesterday(), "mmm dd, yyyy");
Check the complete formatting here
Copyright (c) 2015 Melvin Sembrano. See LICENSE for further details
FAQs
EasyDate is a Javascript extension for easy dates manipulations which is heavily inspired by Rails ActiveSupport::Duration class.
We found that easy-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
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.