All Projects → dbaron → tz.js

dbaron / tz.js

Licence: CC0-1.0 license
A library for working with timezones in JavaScript. Used as part of https://github.com/dbaron/timezone-map .

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to tz.js

graphcountries
An easy to use GraphQL API to query country-related data for free and without restrictions
Stars: ✭ 61 (+144%)
Mutual labels:  timezones
world
A Laravel package which provides a list of the countries, states, cities, currencies, timezones and languages.
Stars: ✭ 479 (+1816%)
Mutual labels:  timezones
scala-java-time
Implementation of the `java.time` API in scala. Especially useful for scala.js
Stars: ✭ 111 (+344%)
Mutual labels:  timezones
Friend-Time
Discord bot - Friend Time helps your server coordinate times and events by converting times mentioned in chat between time zones!
Stars: ✭ 62 (+148%)
Mutual labels:  timezones
hawking
A Natural Language Date Time Parser that Extract date and time from text with context and parse to the required format
Stars: ✭ 168 (+572%)
Mutual labels:  timezones
Luxon
⏱ A library for working with dates and times in JS
Stars: ✭ 11,926 (+47604%)
Mutual labels:  timezones
Dateutil
Useful extensions to the standard Python datetime features
Stars: ✭ 1,706 (+6724%)
Mutual labels:  timezones
Countries
Laravel countries and currencies
Stars: ✭ 1,564 (+6156%)
Mutual labels:  timezones
Pendulum
Python datetimes made easy
Stars: ✭ 4,639 (+18456%)
Mutual labels:  timezones
Spacetime
A lightweight javascript timezone library
Stars: ✭ 3,463 (+13752%)
Mutual labels:  timezones
dayjs
Extended fork of Day.js - 2KB immutable date library alternative to Moment.js
Stars: ✭ 36 (+44%)
Mutual labels:  timezones
ng2-timezone-selector
A simple Angular module to create a timezone selector using moment-timezone.
Stars: ✭ 12 (-52%)
Mutual labels:  timezones
django-timezone-field
A Django app providing DB, form, and REST framework fields for zoneinfo and pytz timezone objects.
Stars: ✭ 322 (+1188%)
Mutual labels:  timezones
tz-trout
Helps you figure out the time zone based on an address or a phone number.
Stars: ✭ 14 (-44%)
Mutual labels:  timezones
timezone-soft
parse informal timezone names
Stars: ✭ 16 (-36%)
Mutual labels:  timezones
ziptz
Get the time zone and daylight saving time support for any US ZIP code
Stars: ✭ 64 (+156%)
Mutual labels:  timezones
# tz.js - Library for working with timezones in JavaScript

# Written in 2011 by L. David Baron <[email protected]>

# 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:

  * You probably need to build on a Unix-ish system (I use Ubuntu Linux;
    Mac OS X probably also works).  (For building the tests correctly, a
    'date' command that deals with a TZ environment variable containing
    file paths is required.)

  * Note that the build process retrieves the latest version of the
    timezone database over the network.

  * Run build.py, and the output appears in the output/ subdirectory.

  * To properly serve tz.js.gz on an Apache server, you probably need
    this in an .htaccess file:
<FilesMatch \.js\.gz$>
  ForceType text/javascript
  AddDefaultCharset UTF-8
  AddEncoding x-gzip gz
</FilesMatch>

  * The output will need to be regenerated from new versions of the
    Time Zone Database in order to continue having correct time zone
    data.  New versions tend to come out about 10-20 times per year.
    See http://www.iana.org/time-zones .

Further notes:

  * The resulting tz.js (produced by build.py), or (preferably) its
    compressed form tz.js.gz, is the only file you need to serve to
    serve the library.  With the current (2016i) copy of the tz
    database, the gzip-compressed tz.js is 54,285 bytes, which includes
    all of the necessary data from the tz database.

  * The documentation of the actual JS API is at the end of tz.js.in.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].