GitHub - dbaron/tz.js: A library for working with timezones in JavaScript. Used as part of https://github.com/dbaron/timezone-map . (original) (raw)

tz.js - Library for working with timezones in JavaScript

Written in 2011 by L. David Baron dbaron@dbaron.org

To the extent possible under law, the author(s) have dedicated all

copyright and related and neighboring rights to this software to the

public domain worldwide. This software is distributed without any

warranty.

You should have received a copy of the CC0 Public Domain Dedication

along with this software. If not, see

<http://creativecommons.org/publicdomain/zero/1.0/>.

This is tz.js, a library for working with time zones from JavaScript.

It incorporates data from the tz database (also known as the Olson database), available at http://www.iana.org/time-zones (with the unofficial repository at https://github.com/eggert/tz ) and in the public domain.

Files currently in the distribution are:

build.py

Python script to produce all output (tz.js and tests).

build-tests.py

Python script to produce the test output (invoked by build.py).

build-tz.py

Python script to build the tz database.

compiled-to-json.py

A working tool for converting the binary timezone data format (see
tzfile(5), available in the tzcode* file in the tz database) into
JSON suitable for use in tz.js.

get-latest-tz-release.py

A tool to download (into this source directory) the latest versions
of the tz database and print their names.

source-to-json.py

Work in progress on a tool to replace compiled-to-json.py (at some
time in the indefinite future) with data allowing the time zone data
to be represented more compactly.

tz.js.in

The source to tz.js, to be compiled using build.py.

The JavaScript API that this library provides is documented at the
end of the tz.js.in file.

A few notes about the goals of this library:

This library intentionally does not support times prior to 1970. This is both because it is unlikely to be useful, and because the timezone database does not split zones if there were differences within them prior to 1970, as described in http://www.iana.org/time-zones/repository/tz-link.html . This means that while the information from the zone data is intended to be valid for the reference city prior to 1970, it is often not valid throughout the zone. Therefore data from the tz database about transitions prior to 1970 have been removed to save space, and times prior to 1970 are intentionally rejected.

Build instructions:

Further notes: