Define a time interval (startTime, endTime) used as a constraint for action execution.
Time interval can be defined in an absolute or relative expression.
An absolute time interval uses the pattern yyyy.MM.dd[,HH:mm] for startTime and endTime properties.
For example, these representations are valid absolute expressions for time interval:
{startTime: "2016.02.01", endTime: "2016.03.01", relative: false}
{startTime: "2016.02.01,09:00", endTime: "2016.03.01,18:00", relative: false}
Absolute time interval are marked with flag relative set to false.
Hour and minutes can be optional in absolute format, by default it takes 00:00 value.
A relative interval is used for repetitive expressions.
It can be defined an interval between months (i.e. December to March), between days of the week
(i.e. Sunday to Friday), between hours and minutes (i.e. 23:00 to 04:30), or a combination of month,
day of the week and/or hours and minutes.
Relative interval uses the pattern [MMM],[WWW],[HH:mm] where months and days of the week can be used in long or short format.
Same pattern should be applied to both startTime and endTime properties.
For example, these representations are valid relative expressions for time interval:
{startTime: "Jul", endTime: "Dec", relative: true}
{startTime: "July", endTime: "December", relative: true}
All dates within July and December months will be valid.
{startTime: "Jul,Mon", endTime: "Dec,Fri", relative: true}
{startTime: "July,Monday", endTime: "December,Friday", relative: true}
All dates within July and December months and within Monday and Friday days are valid.
So, a Sunday day of August will not be valid according previous example.
{startTime: "Jul,Mon,09:00", endTime: "Dec,Fri,18:00", relative: true}
{startTime: "July,Monday", endTime: "December,Friday", relative: true}
All dates within July and December months and within Monday and Friday days and time between 09:00 and18:00 are valid.
So, a Monday day of August at 18:01 will not be valid according previous example.
{startTime:"Monday,09:00", endTime:"Friday,18:00", relative: true}
{startTime:"Mon,09:00", endTime:"Fri,18:00", relative: true}
All dates within Monday and Friday day and time between 09:00 and 18:00 will be valid.
So, a Monday at 18:01 will not be valid according previous example.
{startTime:"July,09:00", endTime:"August,18:00", relative: true}
{startTime:"Jul,09:00", endTime:"Aug,18:00", relative: true}
All dates within July and December months and time between 09:00 and 18:00 are valid.
A day of August at 18:01 will not be valid according previous example.
{startTime:"09:00", endTime:"18:00", relative: true}
All times within 09:00 and 18:00 are valid.
TimeConstraint inRange property defines whether a given time must fall inside or outside
the defined interval. Setting inRange == true means the constraint will be satisfied if a
given date is within the interval (taking the limits as inclusive). By setting
inRange == false the constraint is satisfied if a given date is outside of the interval.
By default, inRange == true.
For example,
{startTime:"09:00", endTime:"18:00", relative: true, inRange: true}
All times within 09:00 and 18:00 are satisfied by the interval.
{startTime:"09:00", endTime:"18:00", relative: true, inRange: false}
All times from 18:01 to 08:59 are satisfied in the interval.
By default the defined absolute or relative intervals use the default time zone (of the server).
This can be unpredictable unless the server time zone is well known and acceptable. It is
recommended to explicitly set the time zone for which the TimeConstraint intervals are applicable.
This is done by setting the timeZoneName property.
For example, here is a TimeConstraint for business hours:
{startTime:"09:00", endTime:"18:00"}
If the server is running in London then this reflects business hours in London. But perhaps the
admins are in New York and the TimeConstraint should actually reflect their local time zone.
In that case use:
{startTime:"09:00", endTime:"18:00", timeZoneName: "America/New_York", relative: true}
It is also possible to use a GMT-relative value:
{startTime:"09:00", endTime:"18:00", timeZoneName: "GMT-5:00", relative: true}