Crono.Schedule (crono v0.1.0)
Functions to work with cron schedules.
Summary
Functions
Calculates the next scheduled run given a Crono.Expression
and a date (defaulting to now).
Calculates the next few scheduled runs given a Crono.Expression
, a date (defaulting to now) and
a count.
Functions
Link to this function
get_next_date(expression, datetime \\ NaiveDateTime.utc_now())
@spec get_next_date(Crono.Expression.t(), NaiveDateTime.t() | DateTime.t()) :: NaiveDateTime.t() | DateTime.t()
Calculates the next scheduled run given a Crono.Expression
and a date (defaulting to now).
Examples
iex> get_next_date(~e[0 0 * * *], ~N[2023-09-01T15:00:00])
~N[2023-09-02T00:00:00]
Link to this function
get_next_dates(expression, datetime \\ NaiveDateTime.utc_now(), count)
@spec get_next_dates(Crono.Expression.t(), NaiveDateTime.t(), pos_integer()) :: [ NaiveDateTime.t() ]
Calculates the next few scheduled runs given a Crono.Expression
, a date (defaulting to now) and
a count.
Examples
iex> get_next_dates(~e[0 0 * * *], ~N[2023-09-01T15:00:00], 3)
[~N[2023-09-02T00:00:00], ~N[2023-09-03T00:00:00], ~N[2023-09-04T00:00:00]]