- Is compatible with the proposals examples (except the time is obligatory)
- Covers all values I found (as far a formal expression is possible at all).
- The very common plain text conditions can be expressed as
"…"
comments. - Can be evaluated sufficently simple™.
Legend:
|
separates alternatives.[
and]
bracket optional components.{
and}
bracket optional repeatable components.- Multiple productions for one symbol connote alternatives.
Symbol | Definition | Comment |
---|---|---|
time_domain |
||
<time_domain> | 24/7 |
→ open |
<fallback_group>
{ ||<fallback_group> } |
[1] | |
<fallback_group> | <rule_sequence>
{ ;<rule_sequence> } |
|
<rule_sequence> |
[ <calendar_ranges> :] <basic_rule> { ;<basic_rule> } |
[2] |
Basic rule |
||
<basic_rule> | <times_for_days> { ,<times_for_days> } |
[3] |
<times_for_days> | open[ <comment> ] |
→ open |
closed[ <comment> ] |
→ closed | |
unknown[ <comment> ] |
→ unknown | |
<comment> | ||
<day_list> off |
→ closed | |
[ <day_list> ] <times> | → open | |
[
<day_list>
]
<times> open[ <comment> ] |
||
[
<day_list>
]
<times> closed[ <comment> ] |
→ closed | |
[
<day_list>
]
<times> unknown[ <comment> ] |
→ unknown | |
[ <day_list> ] <times> <comment> | ||
Days |
||
<day_list> | <day_or_days> { ,<day_or_days> } |
or |
<day_or_days> | [ <weeks> ] { <holiday> } <days> | |
[ <weeks> ]
{ <holiday> } <holiday> [ ±<number> days] |
||
<holiday> | SH| PH |
|
<days> | <wday> | [4] |
<wday> -<wday> |
||
<wday> [<nth_entry> { ,<nth_entry> } ] |
||
<mday> | ||
<mday> -<mday> |
||
<mday> -<mday> /<number> |
[5] | |
<nth_entry> | <nth> | |
<nth> -<nth> |
||
-<nth> |
||
<nth> | 1| 2| 3| 4| 5 |
|
<weeks> | week<week> { ,<week> } |
or |
<week> | <weeknum> | |
<weeknum> -<weeknum> |
||
<weeknum> -<weeknum> /<number> |
[5] | |
Times |
||
<times> | <timespan> { ,<timespan> } |
or |
<timespan> | <time> | |
<time> + |
[6] | |
<time> -<time> |
[7] | |
<time> -<time> + |
||
<time> -<time> /<minute> |
[8] | |
<time> -<time> /<hour_minutes> |
||
<time> | <hour_minutes> | <variable_time> | |
<variable_time> | <event> | |
<event> +<hour_minutes> hours |
||
<event> -<hour_minutes> hours |
||
<event> | sunrise| sunset| … |
|
Calendar |
||
<calendar_ranges> | <calendar_days> { ,<calendar_days> } |
or |
<comment> | [9] | |
<calendar_days> | [ <year> ] <month> | |
[ <year> ] <month> -<month> |
||
[ <year> ] summer |
[10] | |
[ <year> ] winter |
||
<date_with_offsets> | [11] | |
<date_with_offsets> + |
[12] | |
<date_with_offsets> -<date_with_offsets> |
[13] | |
<date_with_offsets> | <date> [ ±<wday> ] [ ±<number> days] |
[14] |
<date> | [ <year> ] <month> <daynum> | |
[ <year> ] <month> <wday> [[ -] <nth> ] |
||
[ <year> ] <variable_date> | ||
<daynum> | [15] | |
<variable_date> | easter| … |
|
Basic elements | ||
<wday> | Su| Mo| Tu| We| Th| Fr| Sa |
|
<weeknum> | 01| 02| 03| 04| 05| 06| 07| 08| 09| 10| 11| 12| 13| 14| 15| 16| 17| 18| 19| 20| 21| 22| 23| 24| 25| 26| 27| 28| 29| 30| 31| 32| 33| 34| 35| 36| 37| 38| 39| 40| 41| 42| 43| 44| 45| 46| 47| 48| 49| 50| 51| 52| 53 |
|
<month> | Jan| Feb| Mar| Apr| May| Jun| Jul| Aug| Sep| Oct| Nov| Dec |
|
<daynum> | 01| 02| 03| 04| 05| 06| 07| 08| 09| 10| 11| 12| 13| 14| 15| 16| 17| 18| 19| 20| 21| 22| 23| 24| 25| 26| 27| 28| 29| 30| 31 |
|
<mday> | 01.| 02.| 03.| 04.| 05.| 06.| 07.| 08.| 09.| 10.| 11.| 12.| 13.| 14.| 15.| 16.| 17.| 18.| 19.| 20.| 21.| 22.| 23.| 24.| 25.| 26.| 27.| 28.| 29.| 30.| 31. |
|
<hour_minutes> | <hour>:<minute> |
|
<hour> | 00| 01| 02| 03| 04| 05| 06| 07| 08| 09| 10| 11| 12| 13| 14| 15| 16| 17| 18| 19| 20| 21| 22| 23| 24 |
|
<minute> | 00| 01| 02| 03| 04| 05| 06| 07| 08| 09| 10| 11| 12| 13| 14| 15| 16| 17| 18| 19| 20| 21| 22| 23| 24| 25| 26| 27| 28| 29| 30| 31| 32| 33| 34| 35| 36| 37| 38| 39| 40| 41| 42| 43| 44| 45| 46| 47| 48| 49| 50| 51| 52| 53| 54| 55| 56| 57| 58| 59| 60 |
|
<comment> | "{Any character except "and ;} " |
- Groups are evaluated from left to right, until one group evaluates to
open
.In discussion
!
was proposed asnot
operator; obviously intended was ashortcut-or
.
Tentatively I introduces||
: one will not type it by chance, it exhibits the cut very good, and every programmer will understand it immediately. - A
basic_rule
is applicable to a day on a all-or-nothing base. The result of evaluating arule_sequenz
is the result of the last rule, which is applicable to the particular day. - The components of a
basic_rule
are additive: the comma between the components is read asand also
.
represents all sundays,Su
represents the first sunday of a month,Su[1]
represents the last sunday of a month.Su[-1]
- This notation is borrowed from
cron
and enables to expressin even weeks
oron odd days
. Open end
: the opening time starts at the given time withopen end
. This kind of indication is used quite often; but of course it is impossible to evaluate it verbatim. I evaluate this notation asplus 4 hours, but no later than midnight
.- If the second time is earlier then the first one,
it is assumed to be on the next day.
The condition evals to true, if first time ≤ particular time < last time holds. - This notation describes a repeated event:
and10:00-16:00/90
are evaluated as10:00-16:00/1:30
from ten am to four pm every 1½ hours
. Especially departure times can be written very concise and compact using this notation. The interval time following the/
is valid but ignored for opening_hours. - Sometimes you cannot (yet) specify exactly the valid calendar days.
In this case you can use plain text in a comment followed by:
. - Calendar ranges were specified by
summer
andwinter
quite often.
I evaluatesummer
toMay-Oct
andwinter
toNov-Apr
. - Evaluates to
true
of the date to check equals this day, tofalse
otherwise. Until further notice
: the calendar range starts at this date and has no upper limit.- Evaluates to
true
, if from-date ≤ day-to-check ≤ to-date holds. Evaluates totrue
, if from-date > to-date holds, year is not specified and either day-to-check ≤ from-date or day-to-check ≧ to-date holds. Evaluates tofalse
otherwise. - Given any calendar day, the notation
selectes the first Sunday after this calendar day, the notation+ Su
selectes the last Sunday before this calendar day.- Su
- A day missing a month is assumed to refer to the last month found before.