Module zone

Module zone 

Source
Expand description

Types for resolving and manipulating time zones.

§Fields

In ICU4X, a TimeZoneInfo consists of up to four different fields:

  1. The time zone ID
  2. The offset from UTC
  3. A timestamp, as time zone names can change over time

§Time Zone

The time zone ID corresponds to a time zone from the time zone database. The time zone ID usually corresponds to the largest city in the time zone.

There are two mostly-interchangeable standards for time zone IDs:

  1. IANA time zone IDs, like "America/Chicago"
  2. BCP-47 time zone IDs, like "uschi"

ICU4X uses BCP-47 time zone IDs for all of its APIs. To get a BCP-47 time zone from an IANA time zone, use IanaParser.

§UTC Offset

The UTC offset precisely states the time difference between the time zone in question and Coordinated Universal Time (UTC).

In localized strings, it is often rendered as “UTC-6”, meaning 6 hours less than UTC (some locales use the term “GMT” instead of “UTC”).

§Timestamp

Some time zones change names over time, such as when changing “metazone”. For example, Portugal changed from “Western European Time” to “Central European Time” and back in the 1990s, without changing time zone ID (Europe/Lisbon, ptlis). Therefore, a timestamp is needed to resolve such generic time zone names.

It is not required to set the timestamp on TimeZoneInfo. If it is not set, some string formats may be unsupported.

§Obtaining time zone information

This crate does not ship time zone offset information. Other Rust crates such as chrono_tz or jiff are available for this purpose. See our example.

Modules§

iana
Tools for parsing IANA time zone IDs.
models
Time zone data model choices.
windows
Tools for parsing Windows timezone IDs.

Structs§

IanaParser
A parser for parsing an IANA time zone ID to a TimeZone type.
IanaParserBorrowed
A borrowed wrapper around the time zone ID parser, returned by IanaParser::as_borrowed(). More efficient to query.
InvalidOffsetError
The time zone offset was invalid. Must be within ±18:00:00.
TimeZone
A CLDR time zone identity.
TimeZoneInfo
A utility type that can hold time zone information.
UtcOffset
An offset from Coordinated Universal Time (UTC).
VariantOffsets
Represents the different offsets in use for a time zone
VariantOffsetsCalculatorDeprecated
VariantOffsetsCalculator uses data from the data provider to calculate time zone offsets.
VariantOffsetsCalculatorBorrowedDeprecated
The borrowed version of a VariantOffsetsCalculator
WindowsParser
A mapper between Windows time zone identifier and a BCP-47 ID.
WindowsParserBorrowed
A borrowed wrapper around the windows time zone mapper data.
ZoneNameTimestamp
The moment in time for resolving a time zone name.

Enums§

TimeZoneVariant
A time zone variant used to identify a display name in CLDR.