ExCycle.Validations.Days (ex_cycle v0.3.0)

Days defines a list of day (day in the week, like monday, tuesday ...) to use in the generated time.

Examples

iex> %Days{days: [:monday]}
# will generate datetimes every monday

iex> %Days{days_by_week: [{-1, :monday}, {2, :saturday}]}
# will generate datetimes every last monday and every second saturday of the month

iex> %Days{days: [:monday], days_by_week: [{1, :tuesday}]}
# Will generate datetimes every monday and every first tuesday of the month

Summary

Types

@type day() ::
  :monday | :tuesday | :wednesday | :thursday | :friday | :saturday | :sunday
@type t() :: %ExCycle.Validations.Days{
  days: [day()],
  days_by_week: [{integer(), day()}]
}
@type week() :: integer()

Functions

@spec new([{week(), day()} | day()]) :: t()