Chrono-TZ
TimeZone implementations for the chrono crate, generated from the IANA time zone database.
Repository Health
Technical Analysis
Chrono-TZ implements chrono’s TimeZone trait for every zone in the IANA time zone database (tzdata), giving Rust programs access to real-world timezone rules including historical offset changes and daylight saving transitions. The zone table is generated at build time by a build script that parses the bundled IANA tz source files via the companion parse-zoneinfo crate, so the library ships with accurate, up-to-date zone data rather than relying on the host OS’s tzdata installation.
Because it plugs directly into chrono’s existing TimeZone trait, converting between zones, formatting localized timestamps, and comparing datetimes across regions works with the same API surface developers already use for Utc and Local, just parameterized over a specific IANA zone like chrono_tz::America::New_York.
What You Get
- A
Tzenum plus per-zone types (e.g.chrono_tz::Europe::London) covering the full IANA tzdata zone list - Correct handling of historical DST rule changes and offset transitions, not just the current UTC offset
- A
FromStrimplementation so zone names like “Antarctica/South_Pole” can be parsed at runtime from configuration or user input - Optional
serdefeature for serializing/deserializing timezone values no_stdcompatibility (withdefault-features = false) for embedded targets- A
filter-by-regexbuild feature to shrink the generated zone table to only the zones an application needs
Common Use Cases
- Converting user-submitted local timestamps to UTC for storage, and back to the user’s local zone for display
- Scheduling systems that need to compute “next occurrence” across a DST transition correctly
- Multi-region applications that display meeting times or logs localized to each user’s IANA timezone
- Parsing timezone identifiers from config files or APIs into a concrete zone type at runtime
Under The Hood
Architecture - The project is a Cargo workspace with three members: chrono-tz (the public library, whose src/timezone_impl.rs and generated src/prebuilt/ module implement chrono’s TimeZone trait per zone), chrono-tz-build (the build-script logic invoked from chrono-tz’s build.rs to regenerate zone tables), and parse-zoneinfo (a standalone parser for the raw IANA tzdata format bundled under tz/). Tech Stack - Pure Rust, edition 2021, MSRV 1.66, dual-licensed MIT/Apache-2.0; the core crate depends on chrono for its TimeZone/Offset traits and optionally serde for serialization, with zone data generated at build time rather than pulled in as a runtime dependency. Code Quality - src/timezone_impl.rs (398 lines) implements the trait machinery generically over the generated per-zone tables, keeping the hand-written logic small relative to the generated prebuilt module; the crate ships tests/ exercising conversions against known reference offsets, and the workspace’s parse-zoneinfo member is independently versioned and tested since other tools consume it directly. API Design - Because it targets chrono’s existing TimeZone trait, the learning curve is minimal for anyone already using chrono — zone-aware datetimes are constructed and manipulated with the same methods as Utc/Local, and the FromStr impl on Tz makes runtime zone lookup from a string a one-line operation.
Used by 3 apps in this directory
AppFlowy
Productivity · Project Management · Collaboration
The open-source AI workspace that puts your data, your rules — with local LLMs, CRDT collaboration, and full self-hosting built in.
InfluxDB
Databases · Analytics
Open-source time-series database built for real-time ingest, fast SQL queries, and embedded Python automation — powered by Apache Arrow and Parquet.
Vaultwarden
Password Manager · Security
Unofficial Bitwarden-compatible server in Rust — run the full Bitwarden ecosystem on a Raspberry Pi using every official client you already have, without the multi-container overhead.