Skip to content

A JavaScript library to detect the timezone using Moment.js

Notifications You must be signed in to change notification settings

Canop/tzdetect.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 

Repository files navigation

tzdetect.js

Notice

There's now a guess 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

Demo

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

Usage

<script src="moment-with-langs.min.js"></script>
<script src="moment-timezone-with-data.min.js"></script>
<script src="tzdetect.js"></script>
<script>
	var tzid = tzdetect.matches()[0]; // for example : "Europe/Paris"
</script>

License

The MIT License.

About

A JavaScript library to detect the timezone using Moment.js

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •