TimeZoneInfo.IanaParser (TimeZoneInfo v0.7.8)

View Source

The IANA-Parser builds the data structure for TimeZoneInfo.

The format of the IANA data explains the article How to Read the tz Database Source Files

Summary

Types

The raw IANA data.

The parsed data.

Functions

Builds the data structure IanaParser.output from the iana_data.

Builds the data structure IanaParser.output from the IANA data in files under path.

Types

data()

@type data() :: binary()

The raw IANA data.

day()

@type day() ::
  non_neg_integer()
  | [{:last_day_of_week, Calendar.day_of_week()}]
  | [day: Calendar.day(), op: op(), day_of_week: Calendar.day_of_week()]

op()

@type op() :: :ge | :le

output()

@type output() :: %{
  optional(:zones) => %{required(Calendar.time_zone()) => [zone_state()]},
  optional(:rules) => %{required(TimeZoneInfo.rule_name()) => [rule()]},
  optional(:links) => %{required(Calendar.time_zone()) => Calendar.time_zone()}
}

The parsed data.

rule()

@type rule() :: [
  from: Calendar.year(),
  to: Calendar.year() | :only,
  in: Calendar.month(),
  on: day(),
  at: time(),
  time_standard: TimeZoneInfo.time_standard(),
  std_offset: Calendar.std_offset(),
  letters: String.t() | nil
]

time()

@type time() :: {Calendar.hour(), Calendar.minute(), Calendar.second()}

until()

zone_state()

@type zone_state() :: [
  utc_offset: Calendar.utc_offset(),
  rules: String.t() | integer() | nil,
  format: TimeZoneInfo.Transformer.Abbr.format(),
  until: until(),
  time_standard: TimeZoneInfo.time_standard()
]

Functions

parse(iana_data)

@spec parse(data()) :: {:ok, output()} | {:error, rest, line, byte_offset}
when rest: String.t(), line: non_neg_integer(), byte_offset: non_neg_integer()

Builds the data structure IanaParser.output from the iana_data.

parse(path, files)

@spec parse(Path.t(), String.t()) ::
  {:ok, output()} | {:error, rest, line, byte_offset}
when rest: String.t(), line: non_neg_integer(), byte_offset: non_neg_integer()

Builds the data structure IanaParser.output from the IANA data in files under path.