Liking cljdoc? Tell your friends :D

org.pilosus/kairos

Clojars Project codecov

Crontab parsing library for Clojure.

  • Supports vixie-cron syntax
  • Parses a crontab entry into a lazy sequence of java.time.ZonedDateTime objects in UTC timezone
  • Explains a crontab entry in plain English

Kairos (καιρός) means the right, critical, or opportune moment.

Install

Clojars Project

Usage

(require '[org.pilosus.kairos :as kairos])

;; 1. Generate a sequence of Date Time objects for a given crontab entry
(kairos/cron->dt "0 10 3,7 Dec Mon")

;; (#object[java.time.ZonedDateTime 0x55eb9b05 "2023-12-03T10:00Z[UTC]"]
;;  #object[java.time.ZonedDateTime 0x2ed291ba "2023-12-04T10:00Z[UTC]"]
;;  ...
;;  #object[java.time.ZonedDateTime 0x749adbda "2024-12-30T10:00Z[UTC]"])


;; 2. Explain a crontab enrty in plain English
(kairos/cron->text "0 6,10-18/2,22 * * Mon-Fri")

;; at minute 0, past hour 6, every 2nd hour from 10 through 18, hour 22, on every day of week from Monday through Friday, in every month

License

See LICENSE.

Can you improve this documentation?Edit on GitHub

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close