Recurrence Patterns
the recurrence pattern as specified in the request body allows you to specify a calendar based interval pattern in a more flexible and intuitive way and exists from an array of string values, each of which are evaluated separately. A single recurrencePattern string could look like:
"Every 2nd day of every 3rd month"
or
"Every 31st december of every second year"
Evaluation of the recurrence pattern string is designed to process a very human readable specification, but is bound to some limitations. Therefore every string must specify the desired period in incrementing parent periods, separated by the keyword ‘of’, like:
"[smallest period] of [larger parent period] of [largest parent period]"
Words like ‘each’ or ‘every’ and suffixes behind numbers can be included for readability, but are not actually required and not evaluated in any way. Therefore the first two examples may also be written as:
"day 2 of month 3"
or
"december 31 of year 2"
Supported time definitions
The different time period definitions that are accepted are:
- ‘day’, indicating a single, 24 hour day.
- weekdays such as ‘Monday’, ‘Tuesday’, etc. Alternatively you can also use three-letter abbreviations such as: ‘Mon’, ‘Tue’, ‘Wed’, etc.
- ‘week’, indicating a week of seven days.
- ‘month’, indicating a full month.
- calendar-months such as ‘January’, ‘February’, etc. Alternatively, three letter abbreviations like ‘Jan’, ‘Feb’ and ‘Mar’ are also accepted.
- ‘quarter’ will refer to the first, second, third or fourth quarter of a year.
- ‘year’ will refer to a single calendar year.
Counting indicators
Besides normal numbers (1,2,3,4, etc.), The recurrence pattern also accepts the following textual counting indicators:
- ‘first’
- ‘last’
- ‘second’, ‘third’, ……… , ‘ninetheenth’ and ‘twentieth’. (Above twenty, this type of counting indicator is no longer supported.
Addition of suffixes to numbers like ‘1st’, ‘2nd’, ‘3rd’, etc. is always supported and not treated any different than a normal number.
Example strings
Please see below examples of valid input strings for the recurrence pattern. All of the below values will give a valid result:
'Every 1st monday of every 2nd week'
'Every last day of the 2nd month'
'Every last friday of each quarter'
'Every 2nd week of january'
'Every 1st wednesday of july'
'Every 818th day'
'Every 1st day of the month'
'Every 5th may of the 2nd year'
'Every 6th day of the 1st week of the 3rd quarter of the 2nd year'
'4th May'
'day 1 of month 2 of year 3'
'2012-06-14 01:46:28'
'06-14'
Note that you can specify multiple recurrence pattern strings at the same time by wrapping them in an array, like:
[
'Every 1st January',
'Every 1st May',
'Every last day of August'
]
