timezone-abbreviations

Crates.iotimezone-abbreviations
lib.rstimezone-abbreviations
version0.1.0
sourcesrc
created_at2021-09-29 13:53:59.209042
updated_at2021-09-29 13:53:59.209042
descriptionTranslate timezone abbreviations into timezone information
homepagehttps://github.com/terhechte/timezone-abbreviations
repositoryhttps://github.com/terhechte/timezone-abbreviations
max_upload_size
id458100
size40,829
Benedikt Terhechte (terhechte)

documentation

README

timezone-abbreviations

This crate allows converting between timezone abbreviations to timezone information.

Note that timezone abbreviations are not standardized:

Keep in mind that time zone abbreviations are not standardized (Hawaii uses both HST or HAST), nor are they unique (CST could belong to US Central Standard Time, Cuba Standard Time, or China Standard TIme), nor do all time zones have abbreviations (many zones in the tzdb zones will just show abbreviations as offsets like "+02"). Also some languages use different abbreviations than we might use in English - example EST in English or HNE in French are both used in Canada for the same zone Matt Johnson-Pint

The data in this crate is based on these two articles:

The way it works is that the content of this page with some manual additions and fixes from Wikipedia were manually downloaded into content.txt. Then, generate.py is used to generate src/generated.rs which contains a static hashmap of all the abbreviations.

This crate uses PHF for a very fast compile-time checked hashmap.

As a convenience, you can just call:

let abbr = timezone_abbreviations::timezone("GMT")
Commit count: 2

cargo fmt