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

One offset a custom time zone observes, and when it starts
([RFC 8984 §4.7.2](https://www.rfc-editor.org/rfc/rfc8984.html#section-4.7.2)).

A rule is the JSCalendar equivalent of an iCalendar `STANDARD` or
`DAYLIGHT` subcomponent: from `start`, the zone stops using
`offset_from` and begins using `offset_to`, and `recurrence_rules`
says when that happens again.

`start` is a local time in `offset_from` — the offset being left, not
the one being joined — because the transition is announced in the
clock reading that people still have at that moment.

# `t`

```elixir
@type t() :: %JSCalendar.TimeZoneRule{
  comments: [String.t()] | nil,
  extra: map(),
  names: MapSet.t() | nil,
  offset_from: String.t() | nil,
  offset_to: String.t() | nil,
  recurrence_overrides:
    %{optional(NaiveDateTime.t()) =&gt; JSCalendar.Patch.t()} | nil,
  recurrence_rules: [JSCalendar.RecurrenceRule.t()] | nil,
  start: NaiveDateTime.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*
