An open API service indexing awesome lists of open source software.

https://github.com/canop/tzdetect.js

A JavaScript library to detect the timezone using Moment.js
https://github.com/canop/tzdetect.js

Last synced: 10 months ago
JSON representation

A JavaScript library to detect the timezone using Moment.js

Awesome Lists containing this project

README

          

tzdetect.js
===========

Notice
------

There's now a [guess](http://momentjs.com/timezone/docs/#/using-timezones/guessing-user-timezone/) API in moment.js, making my library largely useless.

Goals
-----

* detect the user timezone, or more precisely list all IANA time zone ids that are compatible with the running javascript engine
* limit data duplication by using the Moment.js version of the Olson tables

[Related StackOverflow Question](http://stackoverflow.com/questions/19420582/detect-the-id-of-the-current-user-timezone-using-moment-js)

Demo
----

See http://dystroy.org/stackoverflow/timezonedetect.html

Usage
-----





var tzid = tzdetect.matches()[0]; // for example : "Europe/Paris"

License
-------

The [MIT License](http://opensource.org/licenses/MIT).