Crontab format parsing
Format follows that of the Vixie cron: https://man7.org/linux/man-pages/man5/crontab.5.html
┌────────────── minute (0-59) │ ┌──────────── hour (0-23) │ │ ┌────────── day of month (1-31) │ │ │ ┌──────── month (1-12 or Jan-Dec) │ │ │ │ ┌────── day of week (0-7 or Mon-Sun, 0 and 7 are Sunday) │ │ │ │ │
including support for the following Date-Time matching: (month AND hour AND minute AND (day-of-month OR day-of-week))
Short 3-letter names for months and week days are supported, e.g. Jan, Wed.
Sunday's day of week number can be either 0 or 7.
Date-Time entities are java.time.ZonedDateTime objects in given timezone or UTC by default.
Definitions:
cron entry, cron expression, or cron - a string with a schedule
expression that contains fields or a nickname value. NB! In the
context of kairos a cron entry does not contain a command (like
original crontab file's lines do), but only a schedule expression.
field - time and date fragments of the cron entry.
values - each field contains allowed values in the form of single number or a name, their ranges, ranges with step values, lists, or an asterisk.
named value - a 3-letter name for a month or a day of week.
nickname value - one of predefined aliases for useful cron entries.
range - two numbers or named values separated by a hyphen.
step value - range of values with a given step.
list of values - values separated by comma.
Crontab format parsing Format follows that of the Vixie cron: https://man7.org/linux/man-pages/man5/crontab.5.html ┌────────────── minute (0-59) │ ┌──────────── hour (0-23) │ │ ┌────────── day of month (1-31) │ │ │ ┌──────── month (1-12 or Jan-Dec) │ │ │ │ ┌────── day of week (0-7 or Mon-Sun, 0 and 7 are Sunday) │ │ │ │ │ * * * * * including support for the following Date-Time matching: (month AND hour AND minute AND (day-of-month OR day-of-week)) Short 3-letter names for months and week days are supported, e.g. Jan, Wed. Sunday's day of week number can be either 0 or 7. Date-Time entities are java.time.ZonedDateTime objects in given timezone or UTC by default. Definitions: cron entry, cron expression, or cron - a string with a schedule expression that contains fields or a nickname value. NB! In the context of `kairos` a cron entry does not contain a command (like original crontab file's lines do), but only a schedule expression. field - time and date fragments of the cron entry. values - each field contains allowed values in the form of single number or a name, their ranges, ranges with step values, lists, or an asterisk. named value - a 3-letter name for a month or a day of week. nickname value - one of predefined aliases for useful cron entries. range - two numbers or named values separated by a hyphen. step value - range of values with a given step. list of values - values separated by comma.
(cron->dt s)(cron->dt s {:keys [start tz end]})Parse cron entry into a lazy seq of ZonedDateTime objects opts: :start - ZonedDateTime after which to generate times (default: now). Only the instant matters, not its timezone - results after this point in time are included regardless of zone. :tz - ZoneId for generated datetimes (default: UTC) :end - ZonedDateTime before which to generate times (default: nil). If not defined, does not limit resulting lazy seq.
Parse cron entry into a lazy seq of ZonedDateTime objects
opts:
:start - ZonedDateTime after which to generate times (default: now).
Only the instant matters, not its timezone - results after
this point in time are included regardless of zone.
:tz - ZoneId for generated datetimes (default: UTC)
:end - ZonedDateTime before which to generate times (default: nil).
If not defined, does not limit resulting lazy seq.
(cron->map s)Parse a cron entry into a map of ranges
Parse a cron entry into a map of ranges
(cron->text s)(cron->text s {:keys [locale]})Parse cron entry into a human-readable text. opts: :locale - a locale map for translations (default: English). Partial maps are merged with the English defaults. See locale-en for the full schema.
Parse cron entry into a human-readable text.
opts:
:locale - a locale map for translations (default: English).
Partial maps are merged with the English defaults.
See locale-en for the full schema.(cron-valid? s)Return true if a cron entry is valid
Return true if a cron entry is valid
(cron-validate s)Return validation status and error message for a given cron entry
Return validation status and error message for a given cron entry
(crons->overlaps crons)(crons->overlaps crons {:keys [start tz end]})Given a vector of cron entries, return a set of cron pairs that overlap. Pairs are overlapping when at least one firing time coincides for both crons entries.
opts:
:start - ZonedDateTime after which to generate times (default: now).
Only the instant matters, not its timezone - results after
this point in time are included regardless of zone.
:tz - ZoneId for generated datetimes (default: UTC)
:end - a horizon, a ZonedDateTime before which to generate times
(default: 1 year ahead of start).
If not defined, does not limit resulting lazy seq.
Given a vector of cron entries, return a set of cron pairs that overlap.
Pairs are overlapping when at least one firing time coincides for
both crons entries.
opts:
:start - ZonedDateTime after which to generate times (default: now).
Only the instant matters, not its timezone - results after
this point in time are included regardless of zone.
:tz - ZoneId for generated datetimes (default: UTC)
:end - a horizon, a ZonedDateTime before which to generate times
(default: 1 year ahead of ``start``).
If not defined, does not limit resulting lazy seq.
(dt-future? current-dt another-dt)Deprecated: use dt-gt? instead
Deprecated: use dt-gt? instead
(dt-gt? dt1 dt2)Return true if dt1 comes after dt2
Return true if dt1 comes after dt2
(dt-lt? dt1 dt2)Return true if dt1 comes before dt2
Return true if dt1 comes before dt2
(dt-valid? dt days-of-month days-of-week)Return true if a given ZonedDateTime satisfies day-of-month OR day-of-week constrains
Return true if a given ZonedDateTime satisfies day-of-month OR day-of-week constrains
(field->text s field)Parse field values into a human readable text
Parse field values into a human readable text
(field->values s field)Parse a string into a sequence of numbers that represent a given Date-Time field's type, e.g. minutes, hours, days of month, etc.
Parse a string into a sequence of numbers that represent a given Date-Time field's type, e.g. minutes, hours, days of month, etc.
(get-current-dt)(get-current-dt tz)Get current date time
Get current date time
(get-dt year month day hour minute)(get-dt year month day hour minute tz)Return ZonedDateTime in given time zone/UTC or nil for invalid Date-Time
Return ZonedDateTime in given time zone/UTC or nil for invalid Date-Time
(seq-contains? coll e)Return true if a sequence contains the element
Return true if a sequence contains the element
Deprecated: use tz-utc instead
Deprecated: use ``tz-utc`` instead
(validate-value start end field)Return true if value for the given field is valid, throw an exception otherwise
Return true if value for the given field is valid, throw an exception otherwise
Parse a string with the values into a range of integers
Parse a string with the values into a range of integers
(value->ordinal s)Return an ordinal integer number with the proper suffix in English, e.g. 1 -> 1st, 2 -> 2nd, 3 -> 3rd, 15 -> 15th, etc.
Return an ordinal integer number with the proper suffix in English, e.g. 1 -> 1st, 2 -> 2nd, 3 -> 3rd, 15 -> 15th, etc.
Parse a string with the values into a human-readable text
Parse a string with the values into a human-readable text
Parse a frament of the value into a human readable text
Parse a frament of the value into a human readable text
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |