chronos-parser-scala

A cron expression parser.

CI Scala Steward badge Maven Central Renovate License

Installation

Add the following to your sbt build (2.13.x):

val version = "..."

libraryDependencies += Seq(
  "com.github.j5ik2o" %% "chronos-parser-scala" % version,
)

Usage

val cronSchedule   = CronSchedule("*/1 * * * *", ZoneId.systemDefault())
val actuals        = cronSchedule.upcoming(Instant.now()).take(10)
assert(actuals(0) == start)
assert(actuals(1) == start.plus(Duration.ofMinutes(1)))
// ...
actuals.foreach(println)

// 2021-06-03T22:33:16.093Z
// 2021-06-03T22:34:16.093Z
// 2021-06-03T22:35:16.093Z
// 2021-06-03T22:36:16.093Z
// 2021-06-03T22:37:16.093Z
// 2021-06-03T22:38:16.093Z
// 2021-06-03T22:39:16.093Z
// 2021-06-03T22:40:16.093Z
// 2021-06-03T22:41:16.093Z
// 2021-06-03T22:42:16.093Z

License

MIT license (LICENSE or https://opensource.org/licenses/MIT)