Provides utilities for working with crontab time and date specifications.
Crontab
Provides utilities for working with crontab time and date specifications.
Overview
The main class to use is Spec. It can be used to instantiate
valid crontab specs and to generate and match upcoming datetimes
that match it. Its companion object provides a method that can be
used to parse crontab specifications.
Parsing
On success, a Right value containing the Spec is returned:
On failure, a Left value containing a parse error is returned:
scala> val Left(error) = Spec.parse("foo")
error: String =
Invalid input 'f', expected a spec like '0 * * * Sun' or a named rule like '@daily' (line 1, column 1):
foo
^
Spec usage
Specs can be used to generate upcoming dates that match
from a given start time (defaults to the current time + 1 minute):
It is possible for certain specs to cause dateTimes to loop
infinitely (i.e. when no upcoming date times match the spec) so
handle user-input specs with extra care.
Crontab
Provides utilities for working with crontab time and date specifications.
Overview
The main class to use is Spec. It can be used to instantiate valid crontab specs and to generate and match upcoming datetimes that match it. Its companion object provides a method that can be used to parse crontab specifications.
Parsing
On success, a
Right
value containing the Spec is returned:On failure, a
Left
value containing a parse error is returned:Spec usage
Specs can be used to generate upcoming dates that match from a given start time (defaults to the current time + 1 minute):
They can also be used to check if specific dates match:
Warning
It is possible for certain specs to cause
dateTimes
to loop infinitely (i.e. when no upcoming date times match the spec) so handle user-input specs with extra care.