recurring_events v0.1.0 RecurringEvents.ByDay

Handles :by_day rule

Summary

Functions

Applies :by_day rule to given date and returns enumerable. Depends on other rules it may create additional dates keep one provided or remove it. See tests for details

Functions

unfold(date, rules)

Applies :by_day rule to given date and returns enumerable. Depends on other rules it may create additional dates keep one provided or remove it. See tests for details.

Examples

iex> RecurringEvents.ByDay.unfold(~D[2017-01-22],
...>       %{freq: :weekly, by_day: :monday})
...> |> Enum.take(10)
[~D[2017-01-16]]

iex> RecurringEvents.ByDay.unfold(~D[2017-01-22],
...>       %{freq: :monthly, by_day: :sunday})
...> |> Enum.take(10)
[~D[2017-01-01], ~D[2017-01-08], ~D[2017-01-15], ~D[2017-01-22],
 ~D[2017-01-29]]