# `JSCalendar.TimeZone`
[🔗](https://github.com/elixir-tempo/jscalendar/blob/v0.1.0/lib/jscalendar/time_zone.ex#L44)

A time zone defined in the file rather than named from a database
([RFC 8984 §4.7.2](https://www.rfc-editor.org/rfc/rfc8984.html#section-4.7.2)).

Most objects name their zone — `"timeZone": "Australia/Sydney"` — and
leave the offsets to the IANA database. A custom zone exists for the
cases where that is not enough: a sender whose database is newer than
the recipient's, or a zone that is not in any database at all.

`standard` and `daylight` are lists of `t:JSCalendar.TimeZoneRule.t/0`,
and `valid_until` is the sender's honesty about how far ahead the
rules can be trusted.

A custom zone's `tz_id` **must** start with `/`, which is what keeps
it from being mistaken for an IANA name.

# `t`

```elixir
@type t() :: %JSCalendar.TimeZone{
  aliases: MapSet.t() | nil,
  daylight: [JSCalendar.TimeZoneRule.t()] | nil,
  extra: map(),
  standard: [JSCalendar.TimeZoneRule.t()] | nil,
  tz_id: String.t() | nil,
  updated: DateTime.t() | nil,
  url: String.t() | nil,
  valid_until: DateTime.t() | nil
}
```

# `from_map`

```elixir
@spec from_map(map()) :: {:ok, struct()} | {:error, term()}
```

Read this object from a decoded JSON map.

### Arguments

* `map` is a map with string keys, as `:json.decode/1` returns.

### Returns

* `{:ok, object}`; or

* `{:error, reason}` when a property does not match its declared
  type.

# `jscalendar_type`

```elixir
@spec jscalendar_type() :: String.t()
```

The `@type` value RFC 8984 gives this object.

### Returns

* the type name as a string.

# `to_map`

```elixir
@spec to_map(struct()) :: map()
```

Write this object back to a JSON-ready map.

### Arguments

* `object` is a `t:t/0`.

### Returns

* a map with string keys, ready for `:json.encode/1`.

---

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