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
- Host: GitHub
- URL: https://github.com/canop/tzdetect.js
- Owner: Canop
- Created: 2013-10-17T13:54:23.000Z (almost 13 years ago)
- Default Branch: master
- Last Pushed: 2017-01-06T11:57:48.000Z (over 9 years ago)
- Last Synced: 2025-04-01T10:35:53.473Z (over 1 year ago)
- Language: JavaScript
- Size: 5.86 KB
- Stars: 31
- Watchers: 7
- Forks: 8
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
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).