devela::_dep::jiff::tz

Function db

pub fn db() -> &'static TimeZoneDatabase
Available on crate features dep_jiff and alloc only.
Expand description

Returns a copy of the global TimeZoneDatabase.

This is the same database used for convenience routines like Timestamp::intz and parsing routines for Zoned that need to do IANA time zone identifier lookups. Basically, whenever an implicit time zone database is needed, it is this copy of the time zone database that is used.

In feature configurations where a time zone database cannot interact with the file system (like when std is not enabled), this returns a database where every lookup will fail.

ยงExample

use jiff::tz;

assert!(tz::db().get("Antarctica/Troll").is_ok());
assert!(tz::db().get("does-not-exist").is_err());