Cocktail.Schedule.add_recurrence_rule

You're seeing just the function add_recurrence_rule, go back to Cocktail.Schedule module for more information.
Link to this function

add_recurrence_rule(schedule, frequency, options \\ [])

View Source

Specs

add_recurrence_rule(t(), Cocktail.frequency(), Cocktail.rule_options()) :: t()

Adds a recurrence rule of the given frequency to a schedule.

The frequency can be one of :monthly, :weekly, :daily, :hourly, :minutely or :secondly

Options

  • :interval - How often to repeat, given the frequency. For example a :daily rule with interval 2 would be "every other day".
  • :count - The number of times this rule can produce an occurrence. (not yet support)
  • :until - The end date/time after which the rule will no longer produce occurrences.
  • :days_of_month - Restrict this rule to specific days of the month. (e.g. [-1, 10, 31])
  • :days - Restrict this rule to specific days. (e.g. [:monday, :wednesday, :friday])
  • :hours - Restrict this rule to certain hours of the day. (e.g. [10, 12, 14])
  • :minutes - Restrict this rule to certain minutes of the hour. (e.g. [0, 15, 30, 45])
  • :seconds - Restrict this rule to certain seconds of the minute. (e.g. [0, 30])

Examples

iex> start_time = ~N[2017-01-01 06:00:00]
...> start_time |> new() |> add_recurrence_rule(:daily, interval: 2, hours: [10, 14])
#Cocktail.Schedule<Every 2 days on the 10th and 14th hours of the day>