2days; // Sat Jan 03 2015 18:00:00 GMT+0000 (GMT)
Either download the repo and just include
build/timerizer.min.js into your project (using AMD, CommonJS or just good
old globals), or install through npm using
npm install timerizer.
There are two main ways to call Timerizer; you can either use the
constructor function, or you can call one of the time methods directly on
weeks;// Or you can call it directly on numbers4weeks;
This does involve adding a load of properties to
concerns you, there will be a way to disable that behaviour soon.
Time methods are the ones you call on the number, and are specifying the type of interval of time.
The available time methods are
fortnights. There are also singular versions of all those methods.
(I don't like this name. Feel free to suggest better.)
The calculation methods are four methods used to get the actual Date object.
In the past
We've met one of these already, the
.ago() method. The following will return
a Date object for four hours ago:
Pretty simple. You can also give it an argument containing a time to generate
the Date from: e.g., you can specify that you want the time two hours before a
given time. That doesn't make much sense as the
ago method, so there is an
until method aliased to
In the future
The two methods for getting times in the future are called
since, and they behave in pretty much the same way that the methods for
getting times in the past do.
If you want to contribute (thank you!), you'll need to clone the repository
and install the dependencies using
npm install. Run the tests before sending
a pull request (
npm test), and try to avoid sending a pull request from the
This library is released under an MIT license.