bigeasy / timezone

Full-blown timezone aware date math and formatting for JavaScript in 2.7k.
http://bigeasy.github.io/timezone
MIT License
255 stars 26 forks source link

<img src="http://farm4.staticflickr.com/3605/3553572933_5d30ced3e7_b.jpg" alt="Sundial">

Timezone Build Status

Format time in JavaScript using the IANA time zone database. (Photo: Sundial by Wolfgang Staudt.)

var tz = require('timezone/loaded'),
    equal = require('assert').equal,
    utc;

// Get POSIX time in UTC.
utc = tz('2012-01-01');

// Convert UTC time to local time in a localize language.
equal(tz(utc, '%c', 'fr_FR', 'America/Montreal'),
      'sam. 31 déc. 2011 19:00:00 EST');

A full-featured time zone aware date formatter for JavaScript.

Hacking

$ git clone --quiet https://github.com/bigeasy/timezone.git
$ cd timezone && make && npm install && npm test

License

The MIT License.