Product SiteDocumentation Site

8.3. Time- and Date-Based Expressions

As the name suggests, date_expressions are used to control a resource or cluster option based on the current date/time. They may contain an optional date_spec and/or duration object depending on the context.

Table 8.4. Properties of a Date Expression

Field Description
start
A date/time conforming to the ISO8601 specification.
end
A date/time conforming to the ISO8601 specification. Can be inferred by supplying a value for start and a duration.
operation
Compares the current date/time with the start and/or end date, depending on the context. Allowed values:
  • gt: True if the current date/time is after start
  • lt: True if the current date/time is before end
  • in_range: True if the current date/time is after start and before end
  • date_spec: True if the current date/time matches a date_spec object (described below)

Note

As these comparisons (except for date_spec) include the time, the eq, neq, gte and lte operators have not been implemented since they would only be valid for a single second.

8.3.1. Date Specifications

date_spec objects are used to create cron-like expressions relating to time. Each field can contain a single number or a single range. Instead of defaulting to zero, any field not supplied is ignored.
For example, monthdays="1" matches the first day of every month and hours="09-17" matches the hours between 9am and 5pm (inclusive). At this time, multiple ranges (e.g. weekdays="1,2" or weekdays="1-2,5-6") are not supported; depending on demand, this might be implemented in a future release.

Table 8.5. Properties of a Date Specification

Field Description
id
A unique name for the object
hours
Allowed values: 0-23
monthdays
Allowed values: 1-31 (depending on month and year)
weekdays
Allowed values: 1-7 (1=Monday, 7=Sunday)
yeardays
Allowed values: 1-366 (depending on the year)
months
Allowed values: 1-12
weeks
Allowed values: 1-53 (depending on weekyear)
years
Year according to the Gregorian calendar
weekyears
Year in which the week started; e.g. 1 January 2005 can be specified as 2005-001 Ordinal, 2005-01-01 Gregorian or 2004-W53-6 Weekly and thus would match years="2005" or weekyears="2004"
moon
Allowed values are 0-7 (0 is new, 4 is full moon). Seriously, you can use this. This was implemented to demonstrate the ease with which new comparisons could be added.