JSCalendar.TimeZoneRule (JSCalendar v0.1.0)

Copy Markdown View Source

One offset a custom time zone observes, and when it starts (RFC 8984 ยง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.

Summary

Functions

Read this object from a decoded JSON map.

The @type value RFC 8984 gives this object.

Write this object back to a JSON-ready map.

Types

t()

@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()) => JSCalendar.Patch.t()} | nil,
  recurrence_rules: [JSCalendar.RecurrenceRule.t()] | nil,
  start: NaiveDateTime.t() | nil
}

Functions

from_map(map)

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

Read this object from a decoded JSON map.

Arguments

Returns

  • {:ok, object}; or

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

jscalendar_type()

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

The @type value RFC 8984 gives this object.

Returns

  • the type name as a string.

to_map(object)

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

Write this object back to a JSON-ready map.

Arguments

  • object is a t/0.

Returns