Belay.CronExpr (Belay v1.0.0-rc.6)

Copy Markdown View Source

Minimal five-field cron expressions: minute hour day-of-month month day-of-week.

Supports *, numbers, ranges (a-b), steps (*/n, a-b/n), lists (a,b,c), and the nicknames @hourly, @daily, @midnight, @weekly, @monthly. Day-of-week is 0-6 with 0 = Sunday (7 also accepted as Sunday).

Summary

Functions

Does the minute containing datetime (UTC) match?

Parse an expression. Returns {:ok, t} or {:error, reason}.

Truncate a datetime to its minute slot.

Types

t()

@type t() :: %Belay.CronExpr{
  days: term(),
  hours: term(),
  minutes: term(),
  months: term(),
  source: term(),
  weekdays: term()
}

Functions

matches?(expr, datetime)

Does the minute containing datetime (UTC) match?

parse(expression)

Parse an expression. Returns {:ok, t} or {:error, reason}.

parse!(expression)

slot(datetime)

Truncate a datetime to its minute slot.