Permalink
Browse files

Merge pull request #42 from jgable/add_olson_directions

Updating README with directions for getting Olson files
  • Loading branch information...
longlho committed Aug 3, 2012
2 parents 6432331 + 37405ea commit 66754a525fe067a78798969232f7d97307a42501
Showing with 19 additions and 1 deletion.
  1. +1 −1 Jakefile
  2. +18 −0 README.md
View
@@ -20,7 +20,7 @@ namespace('test', function () {
, 'curl ftp://ftp.iana.org/tz/tzdata-latest.tar.gz ' +
'-o lib/tz/tzdata-latest.tar.gz'
, 'echo "Expanding archive ..."'
- , 'tar -xvvzf lib/tz/tzdata-latest.tar.gz -C lib/tz'
+ , 'tar -xvzf lib/tz/tzdata-latest.tar.gz -C lib/tz'
];
jake.mkdirP('lib/tz');
jake.exec(cmds, function () {
View
@@ -22,6 +22,24 @@ First you'll need to include the code on your page. Both `timezoneJS.Date`, and
Next you'll need the Olson time zone files -- `timezoneJS.Date` uses the raw Olson data to calculate timezone offsets. The Olson region files are simple, structured text data, which download quickly and parse easily. (They also compress to a very small size.)
+Here is an example of how to get the Olson time zone files:
+
+ ##!/bin/bash
+
+ # NOTE: Run from your webroot
+
+ # Create the /tz directory
+ mkdir tz
+
+ # Download the latest Olson files
+ curl ftp://ftp.iana.org/tz/tzdata-latest.tar.gz -o tz/tzdata-latest.tar.gz
+
+ # Expand the files
+ tar -xvzf tz/tzdata-latest.tar.gz -C tz
+
+ # Optionally, you can remove the downloaded archives.
+ rm tz/tzdata-latest.tar.gz
+
Then you'll need to make the files available to the `timezoneJS.timezone` code, and initialize the code to parse your default region. (This will be North America if you don't change it). No sense in downloading and parsing timezone data for the entire world if you're not going to be using it.
Put your directory of Olson files somewhere under your Web server root, and point `timezoneJS.timezone.zoneFileBasePath` to it. Then call the init function. Your code will look something like this:

0 comments on commit 66754a5

Please sign in to comment.