CalendarRecurrence.RRULE (calendar_recurrence v0.2.0)

View Source

RRULE parser.

See https://tools.ietf.org/html/rfc5545#section-3.3.10

Summary

Functions

Converts rrule into a recurrence starting at given start date.

Types

t()

@type t() :: %CalendarRecurrence.RRULE{
  byday: term(),
  byhour: term(),
  byminute: term(),
  bymonth: term(),
  bymonthday: term(),
  bysecond: term(),
  byyearday: term(),
  count: non_neg_integer() | nil,
  freq: :monthly | :weekly | :daily | :hourly | :minutely | :secondly | nil,
  interval: pos_integer(),
  until: CalendarRecurrence.date() | nil
}

Functions

parse(binary)

@spec parse(String.t()) :: {:ok, t()} | {:error, term()}

parse!(binary)

@spec parse!(String.t()) :: t() | no_return()

to_recurrence(rrule, start)

@spec to_recurrence(t() | String.t(), CalendarRecurrence.date()) ::
  CalendarRecurrence.t()

Converts rrule into a recurrence starting at given start date.

Examples

iex> RRULE.to_recurrence(%RRULE{freq: :daily}, ~D[2018-01-01]) |> Enum.take(3)
[
  ~D[2018-01-01],
  ~D[2018-01-02],
  ~D[2018-01-03]
]