On this page
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.
Time specifiers
A simple time specifier is composed of a time definition or frame and a scope definition in the following format:
<frame> { <scope>; } #e.g. JAN-MAR {08:00 - 12:00;}
Frame definition
Defines the time frame to be included in the specification (e.g. JAN-MAR).
Scope definition
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 ";".
Hierarchy levels
Time specifiers are ordered in five hierarchical levels:
- Global
- Year
- Month
- Week
- Day
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).
Priority of multiple time specifiers
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.
Absolute vs. relative time fames
Time specifiers can be classified into two categories:
Absolute
Defines the unique and specific parts of the time continuum. This category of time specifiers represents the ones in the global level.
2020/03/25 #this is a unique and specific date
Relative
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.
FRI { 08:00 - 15:00; #the time specifier depends on the "container". In this a day of the week, which is Friday. }
Comments
JWT calendars supports single-line comments. Comments begin with a #. e.g.:
#Summer Calendar
Overview of different levels and priorities
The following table represents all the available time specifiers ordered by level and priority:
High priority | Medium priority | Low priority | |
---|---|---|---|
Level | |||
Global | Date list 2020/03/25, 2020/AUG/18 2017/01/01, 2017/05/01, 2017/12/25-2017/12/31 #can contain intervals | Date 2018/JUN/15-2018/SEP/15 2018/01/01-2018/01/07, 2018/04/10-2018/04/20 | Year list 2000, 2005, 2010 2000-2011 2010-2015, 2018, 2020-2025 #can contain intervals |
Year | Month-Day list JAN/1, MAY/1, JUL/4, DEC/25 | Month-day MAR/20-MAR/25 AUG/1-AUG/15, NOV/5-NOV-15 | Month list JAN, MAR, MAY, DEC JAN-JUN, SEP-DEC #can contain intervals MAY, JUL, OCT-DEC |
Month | Day of month list 1, 15, 30 1-5, 15, 25-3 1, 15-31 25-5 #can contain intervals | ||
Week | Day of week list MON-THU MON-WED, FRI MON, WED, FRI SAT-MON, WED #can contain intervals | ||
Day | Whole day 00:00-00:00; | Time 8:00-15:00; 8:00-15:00, 16:00-19:00; 21:00-3:00; | Empty ; #Can be used to exclude dates Use |
Example specifications
Get some inspiration by looking at the example specifications below.
Calendar | Description |
---|---|
08:00-15:00, 16:00-20:00; | 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.
|
MON-FRI{08:00-15:00, 16:00-20:00;} | Mondays to Fridays from 08:00 to 15:00 and from 16:00 to 20:00. |
MON-THU{08:00-15:00, 16:00-20:00;} FRI{08:00-15:00;} |
|
# Winter Calendar MON - THU { 08:00 - 15:00, 16:00 - 20:00; } FRI { 08:00 - 15:00; } # Summer Calendar JUN/15 - SEP/15 { MON - FRI { 08:00 - 14:30; } } |
|
# Winter Calendar MON - THU { 08:00 - 15:00, 16:00 - 20:00; } FRI { 08:00 - 15:00; } # Summer Calendar JUN/15 - SEP/15 { MON - FRI { 08:00 - 14:30; } } # Annual Holidays JAN/1, MAY/1, NOV/1, DEC/25 {;} # 2021 Holidays 2021/JAN/12, 2021/APR/13, 2021/APR/14, 2021/NOV/23 {;} | This calendar additionally contains a specification for:
|
# NEW Calendar effective 1st December 2020 # Winter Calendar MON-THU { 08:30 - 15:30, 16:00 - 19:30; } FRI { 08:00 - 15:00; } # Summer Calendar JUN/15 - SEP/15 { MON - FRI { 08:00 - 14:30; } } # Annual Holidays JAN/1, MAY/1, JUL/4, NOV/1, DEC/25 {;} # 2021 Holidays 2021/03/27 - 2021/03/30, 2021/10/22 {;} # Current calendar valid up to 30th November 2020 2000/01/01 - 2020/11/30 { # Winter Calendar MON-THU { 08:00 - 15:00, 16:00 - 20:00; } FRI { 08:00 - 15:00; } # Summer Calendar JUN/15 - SEP/15 { MON - FRI { 08:00 - 14:30; } } # Annual Holidays JAN/1, MAY/1, NOV/1, DEC/25 {;} } # 2020 Holidays 2020/JAN/12, 2020/APR/13, 2020/APR/14, 2020/NOV/23 {;} | 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. 2000/01/01 - 2020/11/30 { #global specifier ... } |
If you still have questions, feel free to refer to our support team.