ICAL. Recur

This class represents the "recur" value type, used for example by RRULE. It provides methods to calculate occurrences among others.

Constructor

new Recur(data)

Create a new instance of the Recur class.

Parameters:
NameTypeDescription
dataObject

An object with members of the recurrence

Properties
NameTypeAttributesDescription
freqICAL.Recur.frequencyValues<optional>

The frequency value

intervalNumber<optional>

The INTERVAL value

wkstICAL.Time.weekDay<optional>

The week start value

untilICAL.Time<optional>

The end of the recurrence set

countNumber<optional>

The number of occurrences

bysecondArray.<Number><optional>

The seconds for the BYSECOND part

byminuteArray.<Number><optional>

The minutes for the BYMINUTE part

byhourArray.<Number><optional>

The hours for the BYHOUR part

bydayArray.<String><optional>

The BYDAY values

bymonthdayArray.<Number><optional>

The days for the BYMONTHDAY part

byyeardayArray.<Number><optional>

The days for the BYYEARDAY part

byweeknoArray.<Number><optional>

The weeks for the BYWEEKNO part

bymonthArray.<Number><optional>

The month for the BYMONTH part

bysetposArray.<Number><optional>

The positionals for the BYSETPOS part

Members

(nullable) count :Number

The maximum number of occurrences

Type:
  • Number

freq :ICAL.Recur.frequencyValues

The frequency value.

(constant) icalclass :String

The class identifier.

Type:
  • String
Default Value
  • "icalrecur"

(constant) icaltype :String

The type name, to be used in the jCal object.

Type:
  • String
Default Value
  • "recur"

interval :Number

The interval value for the recurrence rule.

Type:
  • Number

parts :Object

An object holding the BY-parts of the recurrence rule

Type:
  • Object

(nullable) until :ICAL.Time

The end of the recurrence

wkst :ICAL.Time.weekDay

The week start day

Default Value
  • ICAL.Time.MONDAY

Methods

addComponent(aType, aValue)

Adds a component (part) to the recurrence rule. This is not a component in the sense of ICAL.Component, but a part of the recurrence rule, i.e. BYMONTH.

Parameters:
NameTypeDescription
aTypeString

The name of the component part

aValueArray | String

The component value

clone() → {ICAL.Recur}

Returns a clone of the recurrence object.

Returns:

The cloned object

Type: 
ICAL.Recur

fromData(data)

Sets up the current instance using members from the passed data object.

Parameters:
NameTypeDescription
dataObject

An object with members of the recurrence

Properties
NameTypeAttributesDescription
freqICAL.Recur.frequencyValues<optional>

The frequency value

intervalNumber<optional>

The INTERVAL value

wkstICAL.Time.weekDay<optional>

The week start value

untilICAL.Time<optional>

The end of the recurrence set

countNumber<optional>

The number of occurrences

bysecondArray.<Number><optional>

The seconds for the BYSECOND part

byminuteArray.<Number><optional>

The minutes for the BYMINUTE part

byhourArray.<Number><optional>

The hours for the BYHOUR part

bydayArray.<String><optional>

The BYDAY values

bymonthdayArray.<Number><optional>

The days for the BYMONTHDAY part

byyeardayArray.<Number><optional>

The days for the BYYEARDAY part

byweeknoArray.<Number><optional>

The weeks for the BYWEEKNO part

bymonthArray.<Number><optional>

The month for the BYMONTH part

bysetposArray.<Number><optional>

The positionals for the BYSETPOS part

getComponent(aType) → {Array}

Gets (a copy) of the requested component value.

Parameters:
NameTypeDescription
aTypeString

The component part name

Returns:

The component part value

Type: 
Array

getNextOccurrence(aStartTime, aRecurrenceId) → {ICAL.Time}

Retrieves the next occurrence after the given recurrence id. See the guide on terminology for more details.

NOTE: Currently, this method iterates all occurrences from the start date. It should not be called in a loop for performance reasons. If you would like to get more than one occurrence, you can iterate the occurrences manually, see the example on the iterator method.

Parameters:
NameTypeDescription
aStartTimeICAL.Time

The start of the event series

aRecurrenceIdICAL.Time

The date of the last occurrence

Returns:

The next occurrence after

Type: 
ICAL.Time

isByCount() → {Boolean}

Checks if the current rule has a count part, and not limited by an until part.

Returns:

True, if the rule is by count

Type: 
Boolean

isFinite() → {Boolean}

Checks if the current rule is finite, i.e. has a count or until part.

Returns:

True, if the rule is finite

Type: 
Boolean

iterator(aStart) → {ICAL.RecurIterator}

Create a new iterator for this recurrence rule. The passed start date must be the start date of the event, not the start of the range to search in.

Parameters:
NameTypeDescription
aStartICAL.Time

The item's start date

Returns:

The recurrence iterator

Type: 
ICAL.RecurIterator
Example
let recur = comp.getFirstPropertyValue('rrule');
let dtstart = comp.getFirstPropertyValue('dtstart');
let iter = recur.iterator(dtstart);
for (let next = iter.next(); next; next = iter.next()) {
  if (next.compare(rangeStart) < 0) {
    continue;
  }
  console.log(next.toString());
}

setComponent(aType, aValues)

Sets the component value for the given by-part.

Parameters:
NameTypeDescription
aTypeString

The component part name

aValuesArray

The component values

toJSON() → {Object}

The jCal representation of this recurrence type.

Returns:
Type: 
Object

toString() → {String}

The string representation of this recurrence rule.

Returns:
Type: 
String

(static) fromData(aData)

Creates a new ICAL.Recur instance using members from the passed data object.

Parameters:
NameTypeDescription
aDataObject

An object with members of the recurrence

Properties
NameTypeAttributesDescription
freqICAL.Recur.frequencyValues<optional>

The frequency value

intervalNumber<optional>

The INTERVAL value

wkstICAL.Time.weekDay<optional>

The week start value

untilICAL.Time<optional>

The end of the recurrence set

countNumber<optional>

The number of occurrences

bysecondArray.<Number><optional>

The seconds for the BYSECOND part

byminuteArray.<Number><optional>

The minutes for the BYMINUTE part

byhourArray.<Number><optional>

The hours for the BYHOUR part

bydayArray.<String><optional>

The BYDAY values

bymonthdayArray.<Number><optional>

The days for the BYMONTHDAY part

byyeardayArray.<Number><optional>

The days for the BYYEARDAY part

byweeknoArray.<Number><optional>

The weeks for the BYWEEKNO part

bymonthArray.<Number><optional>

The month for the BYMONTH part

bysetposArray.<Number><optional>

The positionals for the BYSETPOS part

(static) fromString(string) → {ICAL.Recur}

Creates a new ICAL.Recur instance from the passed string.

Parameters:
NameTypeDescription
stringString

The string to parse

Returns:

The created recurrence instance

Type: 
ICAL.Recur

(static) icalDayToNumericDay(string, aWeekStartopt) → {Number}

Convert an ical representation of a day (SU, MO, etc..) into a numeric value of that day.

Parameters:
NameTypeAttributesDescription
stringString

The iCalendar day name

aWeekStartICAL.Time.weekDay<optional>

The week start weekday, defaults to SUNDAY

Returns:

Numeric value of given day

Type: 
Number

(static) numericDayToIcalDay(num, aWeekStartopt) → {String}

Convert a numeric day value into its ical representation (SU, MO, etc..)

Parameters:
NameTypeAttributesDescription
numNumber

Numeric value of given day

aWeekStartICAL.Time.weekDay<optional>

The week start weekday, defaults to SUNDAY

Returns:

The ICAL day value, e.g SU,MO,...

Type: 
String

Type Definitions

frequencyValues

Possible frequency values for the FREQ part (YEARLY, MONTHLY, WEEKLY, DAILY, HOURLY, MINUTELY, SECONDLY)

Type:
  • String