Introducing Time Traveller, date library for node.js (and javascript).

Published on Nov 07, 2011

Javascript has the Date object that exposes a series of methods to create new dates, modify them and get the different “parts” of a date. It’s not bad but is certainly fairly limited.

I wanted to create a simpler, easier way to work with dates.

Introducing Time Traveller

Time traveller is my attempt to provide a better api to work with date and time operations. My hope is to grow this library to make working with dates as enjoyable as possible.

You can get time traveller using npm:

    npm install timeTraveller

Or you can get the code from the github repo



Factory object that returns an extended Date with some utility methods to do comparison and perform common operations on dates.

As of version 0.2.1 only has a now() factory method that’s equivalent to doing new Date().

The returned date object is enhanced with some utility methods as described below.

Add methods

The available add methods are:

These methods can take either a positive or a negative number. A negative number will result in the substraction of the given period.

For example:

The add* methods are chainable, so you could call

isSame** methods

There is a main isSame() method that takes a date and can also have a single character that indicates precision.


There are also methods for every precision that make a cleaner API.


A simple object tha represents a period of time. As of version 0.2.1 a TimeSpan object can be created in 3 ways.
Calling the differenceFrom(secondDate) method on an enhanced Date object, passing milliseconds into the constructor, or passing two dates into the contructor


Sometime in the near future I will have to add formatting capabilities and string date parsing capabilities to the main object.