Utility Determine Next Occurrence VERSION 2


This handler uses the IceCube library to configure a schedule and then based on a start date, calculates the next occurrence. This value is returned in string format in the result field 'next_occurrence'.

The bulk of the handler code evaluates and transforms the inputs so the IceCube library can define the schedule and then perform the evaluation.


Parameters

NameDescription
Start (UTC)The time when the schedule should begin looking for the next occurrence. Enter in a parsable Ruby time (standard Request CE Datetime field works; ex format YYYY-MM-DDTHH:MM:SS+00:00).
Recurrence TypeValid options are 'minutely' [requires interval],'hourly' [requires interval],'daily' [requires interval],'weekly' [requires interval],'monthly' [requires timing, interval and either weekdays or days of month],'yearly' [requires timing, interval, months, and either weekdays or days of month]
TimingRequired for monthly and yearly Recurrence Types. Valid options are 'Relative' or 'Absolute'. Relative refers to relatives dates (ex: First Monday in May and June) and Absolute refers to specific dates (ex: 7th and 10th of June)
IntervalThe interval between the recurrence_type values.
MonthsThe months in which this schedule should execute. Possible vales are entered in a comma separated list, with the values of 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'. Any combination of values is fine. Example: January, April, July, October
Days of MonthThe dates on which this schedule should execute. Possible vales are entered in a comma separated list, with the values of 1 through 31, and 'last'. Any combination of values is fine. Example: 1, 15, Last
WeekdaysThe weekdays in which this schedule should execute. Possible vales are entered in a comma separated list, with the values of 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'. Any combination of values is fine. Example: Monday, Thursday, Saturday
Sunday IndexRequired when Sunday field is populated AND recurrence type is NOT weekly. Possible values are entered in a comma separated list, with the values of 'All', 'First, 'Second', 'Third', 'Fourth', 'Last'. 'All' is exclusive to other values. If not using 'All', any combination of other values is fine. Example 1: All, Example 2: First, Second, Last
Monday IndexRequired when Monday field is populated AND recurrence type is NOT weekly. Possible values are entered in a comma separated list, with the values of 'All', 'First, 'Second', 'Third', 'Fourth', 'Last'. 'All' is exclusive to other values. If not using 'All', any combination of other values is fine. Example 1: All, Example 2: First, Second, Last
Tuesday IndexRequired when Tuesday field is populated AND recurrence type is NOT weekly. Possible values are entered in a comma separated list, with the values of 'All', 'First, 'Second', 'Third', 'Fourth', 'Last'. 'All' is exclusive to other values. If not using 'All', any combination of other values is fine. Example 1: All, Example 2: First, Second, Last
Wednesday IndexRequired when Wednesday field is populated AND recurrence type is NOT weekly. Possible values are entered in a comma separated list, with the values of 'All', 'First, 'Second', 'Third', 'Fourth', 'Last'. 'All' is exclusive to other values. If not using 'All', any combination of other values is fine. Example 1: All, Example 2: First, Second, Last
Thursday IndexRequired when Thursday field is populated AND recurrence type is NOT weekly. Possible values are entered in a comma separated list, with the values of 'All', 'First, 'Second', 'Third', 'Fourth', 'Last'. 'All' is exclusive to other values. If not using 'All', any combination of other values is fine. Example 1: All, Example 2: First, Second, Last
Friday IndexRequired when Friday field is populated AND recurrence type is NOT weekly. Possible values are entered in a comma separated list, with the values of 'All', 'First, 'Second', 'Third', 'Fourth', 'Last'. 'All' is exclusive to other values. If not using 'All', any combination of other values is fine. Example 1: All, Example 2: First, Second, Last
Saturday IndexRequired when Saturday field is populated AND recurrence type is NOT weekly. Possible values are entered in a comma separated list, with the values of 'All', 'First, 'Second', 'Third', 'Fourth', 'Last'. 'All' is exclusive to other values. If not using 'All', any combination of other values is fine. Example 1: All, Example 2: First, Second, Last

Sample Configuration

NameDescription
Start (UTC)2016-09-25 14:00:00 UTC
Recurrence TypeMonthly
TimingRelative
Interval1
MonthsJanuary, April, July, October
Days of Month
WeekdaysMonday
Sunday Index
Monday IndexFirst
Tuesday Index
Wednesday Index
Thursday Index
Friday Index
Saturday Index

Results

NameSample Result
next_occurrenceThis handler returns the Next Occurrence in UTC time based on the inputs. Example: 2018-03-02 22:00:00 UTC

Changelog

Utility Determine Next Occurrence V2 (2017-03-03)

* Initial version. See README for details.