A calendar is a system on which JWT will be able to do time calculations. Each calendars should be composed of at least one time specifier.
Each calendar configuration is highly flexible but the underlying specification must follow a dedicated syntax.
A simple time specifier is composed of a time definition or frame and a scope definition in the following format:
Defines the time frame to be included in the specification (e.g. JAN-MAR).
The scope definition further refines a time frame. Multiple time definitions and scopes can be specified and nested based on their hierarchy level.
Each scope needs to be ended with a ";".
Time specifiers are ordered in five hierarchical levels:
A time specifier of a particular level is always explicitly or implicitly contained in a time specifier of the immediately higher level (e.g. a day is contained in a month).
When the higher level time specifier is not configured (e.g. no month defined) , then it is implicitly contained in an unrestricted higher level time specifier (e.g. year).
|Every day between 8AM and 6PM.|
|Only during the week, since the week "level" is higher than the day level.|
|Only in January, since the year "level" is higher than the week or day level..|
Absolute vs. relative time fames
Time specifiers can be classified into two categories:
Defines the unique and specific parts of the time continuum. This category of time specifiers represents the ones in the global level.
Define parts of the time in the context of other time specifiers. The definition depends on the time specifier where it is contained. This category of time specifiers is contained in the all levels besides the global.
JWT calendars supports single-line comments. Comments begin with a #. e.g.:
Examples and syntax details
The following table represents all the available time specifiers ordered by level and priority.
Time specifiers each have a dedicated priority. In case that two or more time specifiers overlap in the same level, the one with the highest priority is applied.
Time specifiers with the same priority in the same level are not allowed to overlap, i.e., the intersection of their time definitions must be empty.
|High priority||Medium priority||Low priority|
Day of month list
Day of week list
Get some inspiration by looking at the example specifications below.
Any date-time with time part between 08:00 and 15:00, or 16:00 and 20:00.
By convention 15:00 and 20:00 (the outer limits of the time frame) are outside of the calendar definition.
|Mondays to Fridays from 08:00 to 15:00 and from 16:00 to 20:00.|
This calendar additionally contains a specification for:
This example combines two calendars.
A future calendar coming into effect on December 1st of 2021 and the currently valid calendar.
Since the 2nd calendar is wrapped in a global time specifier with higher priority it is the one that is currently valid.
The syntax of the calendar specification follows the Backus-Naur form. Read more about the details.
<schedule> ::= <global_level_specifier> +
<global_level_specifier> ::= <date_interval_list>
} | <date_list>
} | <year_list>
} | <year_level_specifier>+
<year_level_specifier> ::= <month_day_list>
} | <month_day_interval_list>
} | <month_list>
} | <month_level_specifier>+
<month_level_specifier> ::= <day_of_month_list>
} | <week_level_specifier>+
<week_level_specifier> ::= <day_of_week_list>
} | <day_level_specifier>+
<day_level_specifier> ::= <time_interval_list>
<time_interval_list> ::= <time_interval> (
<time_interval> ::= <time_literal>
<date_interval_list> ::= <date_interval> (
<date_list> ::= (<date_literal> | <date_interval>) (
, (<date_literal> | <date_interval>))*
<date_interval> ::= <date_literal>
<year_list> ::= (<year> | <year_interval>) (
, (<year> | <year_interval>))*
<year_interval> ::= <year>
<month_day_list> ::= <month_day> (
<month_day_interval_list> ::= <month_day_interval> (
<month_day_interval> ::= <month_day>
<month_day> ::= <month>
<month_list> ::= (<month> | <month_interval>) (
, (<month> | <month_interval>))*
<day_of_month_list> ::= (<day_of_month> | <day_of_month_interval>) (
, (<day_of_month> | <day_of_month_interval>))*
<day_of_month_interval> ::= <day_of_month>
<day_of_week_list> ::= (<day_of_week> | <day_of_week_interval>) (
, (<day_of_week> | <day_of_week_interval>))*