• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

config/H03-Sep-2018-86

lib/H03-Sep-2018-2,0801,798

priv/release_ets/H03-Sep-2018-

test/H03-Sep-2018-17,36815,957

.formatter.exsH A D03-Sep-2018105 54

.gitignoreH A D03-Sep-201868 76

.travis.ymlH A D03-Sep-2018119 1211

CHANGELOG.mdH A D03-Sep-20185.5 KiB205136

LICENSEH A D03-Sep-20181 KiB1817

README.mdH A D03-Sep-20183.5 KiB10972

mix.exsH A D03-Sep-2018890 5144

mix.lockH A D03-Sep-20182 KiB1413

README.md

1Tzdata
2======
3
4[![Build
5Status](https://travis-ci.org/lau/tzdata.svg?branch=master)](https://travis-ci.org/lau/tzdata)
6
7Tzdata. The [timezone database](https://www.iana.org/time-zones) in Elixir.
8
9Extracted from the [Calendar](https://github.com/lau/calendar) library.
10
11As of version 0.5.17 the tz release 2018e
12is included in the package.
13
14When a new release is out, it will be automatically downloaded.
15
16The tz release version in use can be verified with the following function:
17
18```elixir
19iex> Tzdata.tzdata_version
20"2018e"
21```
22
23## Getting started
24
25Use through the [Calendar](https://github.com/lau/calendar) library
26or directly: it is available on hex as `tzdata`.
27
28```elixir
29defp deps do
30  [  {:tzdata, "~> 0.5.19"},  ]
31end
32```
33
34The Tzdata app must be started. This can be done by adding :tzdata to
35the applications list in your mix.exs file. An example:
36
37```elixir
38  def application do
39    [applications: [:logger, :tzdata],
40    ]
41  end
42```
43
44## Data directory and releases
45
46The library uses a file directory to store data. By default this directory
47is `priv`. In some cases you might want to use a different directory. For
48instance when using releases this is recommended. If so, create the directory and
49make sure Elixir can read and write to it. Then use elixir config files like this
50to tell Tzdata to use that directory:
51
52```elixir
53config :tzdata, :data_dir, "/etc/elixir_tzdata_data"
54```
55
56Add the `release_ets` directory from `priv` to that directory
57containing the `20xxx.ets` file that ships with this library.
58
59For instance with this config: `config :tzdata, :data_dir, "/etc/elixir_tzdata_data"`
60an `.ets` file such as `/etc/elixir_tzdata_data/release_ets/2017b.ets` should be present.
61
62## Automatic data updates
63
64By default Tzdata will poll for timezone database updates every day.
65In case new data is available, Tzdata will download it and use it.
66
67This feature can be disabled with the following configuration:
68
69```elixir
70config :tzdata, :autoupdate, :disabled
71```
72
73If the autoupdate setting is set to disabled, one has to manually put updated .ets files
74in the release_ets sub-dir of the "data_dir" (see the "Data directory and releases" section above).
75When IANA releases new versions of the time zone data, this Tzdata library can be used to generate
76a new .ets file containing the new data.
77
78## Changes from 0.1.x
79
80The 0.5.1+ versions uses ETS tables and automatically polls the IANA
81servers for updated data. When a new version of the timezone database
82is available, it is automatically downloaded and used.
83
84For use with [Calendar](https://github.com/lau/calendar) you can still
85specify tzdata ~> 0.1.7 in your mix.exs file in case you experience problems
86using version ~> 0.5.2.
87
88
89## Hackney dependency and security
90
91Tzdata depends on Hackney in order to do HTTPS requests to get new updates. This is done because Erlang's built in HTTP client `httpc` does not verify SSL certificates when doing HTTPS requests. Hackney verifies the certificate of IANA when getting new tzdata releases from IANA.
92
93## Documentation
94
95Documentation can be found at http://hexdocs.pm/tzdata/
96
97## When new timezone data is released
98
99IANA releases new versions of the [timezone database](https://www.iana.org/time-zones) frequently.
100
101For users of Tzdata version 0.5.x+ the new database will automatically
102be downloaded, parsed, saved and used in place of the old data.
103
104## License
105
106The tzdata Elixir library is released under the MIT license. See the LICENSE file.
107
108The tz database files (found in the source_data directory) is public domain.
109