Commits

Jon Nylander committed 6d2243b

Edited online

Comments (0)

Files changed (1)

-== Timezone detection in JavaScript ==
+=== How do I use jsTimezoneDetect? ===
 
-Determining timezones using javascript is not trivial out of the box. Different browsers use different acronyms and conventions for representing names of timezones, it also differs depending on the user's operating system.
+This script does one thing and one thing alone. It gives you the zone info key of a timezone that describes the timezone you are in.
 
-This little script tries to take a pragmatic approach by using a few simple algorithms using the JavaScript Date object. 
+It is synchronous, fast and about 1.65 KB gzipped (4.9 KB uncompressed).
 
-If you are interested about the code details, read [[About_the_code|About the Code]].
+Download the latest minified version. Include it on a webpage. Then:
+
+{{{
+#!javascript
+var timezone = jstz.determine();
+timezone.name(); 
+"Europe/Berlin"
+}}}
+
+If you are interested in the code details, read [[About_the_code|About the Code]].
 
 [[Detection_List|Click here for a link to a list of timezones that the script can detect]].
 
 
 Contact me: <<user pellepim>>, if you have any questions.
 
-=== How to use jsTimezoneDetect ===
+===What do I do with the result?===
+jsTimezoneDetect gives you a timezone key, compliant with the zoneinfo database. Often called the "Olson database", or simply the tz database. It is a public domain collaborative compilation of information about the world's timezones.
 
-To simply store away a user's timezone in a variable, you can simply import timezone_detect.js and do the following.
-
-{{{
-#!javascript
-
-var timezone = jstz.determine_timezone(); // Now you have an instance of the TimeZone object.
-
-alert(timezone.offset()); // Offset in hours and minutes from UTC.
-alert(timezone.name()); // Olson database timezone key (ex: Europe/Berlin)
-alert(timezone.dst()); // bool for whether the tz uses daylight saving time
-
-}}}
-
-This gives you an Olson database key you can use for datetime calculations in most programming languages.
-
-Read more about the details in [[About_the_code|About the Code]].
+It is widely used as basis for timezone information in operating systems and software. Nearly all platforms and programming languages have libraries that support it.
 
 === Who would benefit from this script? ===