Prebuilt timezone information for Gleam.
Find a file
2026-04-24 21:35:18 +03:00
dev Add more stuff for packaging 2026-03-11 20:14:39 +02:00
src Build 2026b 2026-04-24 21:35:18 +03:00
tz@48c25a1ba8 Build 2026b 2026-04-24 21:35:18 +03:00
.gitignore macOSSSSSSSS 2026-03-11 00:19:15 +02:00
.gitmodules Initial commit 2026-03-11 00:17:52 +02:00
build.sh Add explicit transitions to data to make up for lack of proleptic support 2026-03-14 20:11:50 +02:00
CHANGELOG.txt Build 2026b 2026-04-24 21:35:18 +03:00
gleam.toml Build 2026b 2026-04-24 21:35:18 +03:00
LICENSE Add more stuff for packaging 2026-03-11 20:14:39 +02:00
manifest.toml Build 2026b 2026-04-24 21:35:18 +03:00
mise.toml Initial commit 2026-03-11 00:17:52 +02:00
README.md Build 2026b 2026-04-24 21:35:18 +03:00

zones

Package Version Hex Docs

Prebuilt time zone data for the tzif package.

Current tzdata version: 2026b.

When to use

Generally you should prefer loading time zone information provided by your operating system by using tzif directly. In some cases this may not be preferrable:

  • if your operating system is not being updated,
  • if your operating system's time zone information lags behind in updates, or
  • if you just otherwise want to control which specific version you are using.

In these situations you may opt to download time zone data from IANA, process it with zic, and then load it with tzif. Alternatively, you may use this package which has done that part for you.

The downside of this package is that you have to keep it updated by updating the dependency, and thus releasing a new version of your app. Take this into account when making your decision on which method to use for obtaining time zone information.

Versioning

This package follows modified semantic versioning:

  • The major version is bumped if there are backwards incompatible changes to any interfaces.
  • The minor version is bumped on backwards compatible feature additions and tzdata version changes. It is of the form XXYYF, where XX is the last two numbers of the tzdata year, YY is a running count, corresponding to the character of the tzdata version — i.e. a=1, b=2, and so on — and F is increased if there are any feature additions that do not change the tzdata version.
  • The patch version is reserved for any backwards compatible bug fixes that do not change interfaces and do not introduce new features.

Thus you can always see the tzdata version that the package contains from the first four numbers of the minor version.

Usage

gleam add zones@1
import zones
import tzif/tzcalendar
import tzif/database

pub fn main() -> Nil {
  let now = timestamp.system_time()

  // Load all timezones
  let tzdb = zones.database()

  case tzcalendar.to_time_and_zone(now, "Europe/Helsinki", db) {
    Ok(time_and_zone) -> // See tzif documentation on further usage
    ...
  }

  // Alternatively, construct your own database from only the zones you want
  let tzdb = database.new()
  |> database.add_tzfile("Europe/Helsinki", zones.europe__helsinki)
  |> database.add_tzfile("Indian/Reunion", zones.indian__reunion)
}