# `Tempo.Iso8601.Tokenizer.Extended`
[🔗](https://github.com/kipcole9/tempo/blob/v0.5.0/lib/iso8601/tokenizer/extended.ex#L1)

Tokenizer combinators and post-processing for the
Internet Extended Date/Time Format (IXDTF) defined in
[draft-ietf-sedate-datetime-extended-09](https://www.ietf.org/archive/id/draft-ietf-sedate-datetime-extended-09.html).

An IXDTF suffix follows a normal RFC 3339 / ISO 8601 date-time
and consists of:

* An optional time zone in square brackets such as
  `[Europe/Paris]` or `[+08:45]`.

* Zero or more tagged suffixes such as `[u-ca=hebrew]` or
  `[_experimental=value]`.

Any bracketed segment may be prefixed with `!` to mark it as
**critical**.  Critical segments that are not recognised by
the parser cause the parse to fail.  Elective (non-critical)
segments that are not recognised are retained verbatim under
the `:tags` key of the extended map.

Calendar identifiers under the `u-ca` key are validated with
`Localize.validate_calendar/1`.  Time zone names are validated
with `Tzdata.zone_exists?/1`.

# `extended_suffix`

Combinator that parses the IXDTF suffix.

Produces a single token of the form `{:extended, raw_segments}`
where each raw segment is a keyword list describing one
bracket pair.

# `split_extended`

Split a raw token list into regular tokens and the parsed
extended-information map.

The tokenizer emits an `{:extended, segments}` entry as the last
element of the token list when an IXDTF suffix is present.  This
function unpacks those segments into a validated map and returns
the remaining tokens.

### Arguments

* `tokens` is the raw token list produced by the tokenizer.

### Returns

* `{:ok, {regular_tokens, extended_info_or_nil}}` on success
  where `extended_info_or_nil` is `nil` when no IXDTF suffix
  was parsed or a map with keys `:calendar`, `:zone_id`,
  `:zone_offset` and `:tags`.

* `{:error, reason}` when a critical suffix is unrecognised
  or fails validation.

### Examples

    iex> {:ok, {_, extended}} =
    ...>   Tempo.Iso8601.Tokenizer.Extended.split_extended(
    ...>     [{:datetime, []}, {:extended, [[zone: "Europe/Paris"]]}])
    iex> extended.zone_id
    "Europe/Paris"

---

*Consult [api-reference.md](api-reference.md) for complete listing*
