Class Recur

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

Alias

ICAL.Recur

Hierarchy

  • Recur

Constructors

  • Create a new instance of the Recur class.

    Parameters

    • data: RecurData

      An object with members of the recurrence

    Returns Recur

Properties

count?: number

The maximum number of occurrences

freq?: "SECONDLY" | "MINUTELY" | "HOURLY" | "DAILY" | "WEEKLY" | "MONTHLY" | "YEARLY"

The frequency value.

icalclass: "icalrecur" = 'icalrecur'

The class identifier.

icaltype: "recur" = 'recur'

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

interval: number = 1

The interval value for the recurrence rule.

parts: object

An object holding the BY-parts of the recurrence rule

until?: Time

The end of the recurrence

wkst: WeekDay = Time.MONDAY

The week start day

wrappedJSObject: Recur

Methods

  • 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

    • aType: string

      The name of the component part

    • aValue: string | any[]

      The component value

    Returns void

  • Returns a clone of the recurrence object.

    Returns Recur

    The cloned object

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

    Parameters

    • data: RecurData

      An object with members of the recurrence

    Returns void

  • Gets (a copy) of the requested component value.

    Parameters

    • aType: string

      The component part name

    Returns any[]

    The component part value

  • Retrieves the next occurrence after the given recurrence id. See the guide on {@tutorial 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 ICAL.Recur#iterator iterator method.

    Parameters

    • aStartTime: Time

      The start of the event series

    • aRecurrenceId: Time

      The date of the last occurrence

    Returns Time

    The next occurrence after

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

    Returns boolean

    True, if the rule is by count

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

    Returns boolean

    True, if the rule is finite

  • 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

    • aStart: Time

      The item's start date

    Returns RecurIterator

    The recurrence iterator

    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());
    }
  • Sets the component value for the given by-part.

    Parameters

    • aType: string

      The component part name

    • aValues: any[]

      The component values

    Returns void

  • The jCal representation of this recurrence type.

    Returns object

  • The string representation of this recurrence rule.

    Returns string

  • Private

    Converts a recurrence string to a data object, suitable for the fromData method.

    Parameters

    • string: string

      The string to parse

    • fmtIcal: boolean

      If true, the string is considered to be an iCalendar string

    Returns RecurData

    The recurrence instance

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

    Parameters

    • aData: RecurData

      An object with members of the recurrence

    Returns Recur

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

    Parameters

    • string: string

      The string to parse

    Returns Recur

    The created recurrence instance

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

    Parameters

    • string: string

      The iCalendar day name

    • Optional aWeekStart: WeekDay

      The week start weekday, defaults to SUNDAY

    Returns number

    Numeric value of given day

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

    Parameters

    • num: number

      Numeric value of given day

    • Optional aWeekStart: WeekDay

      The week start weekday, defaults to SUNDAY

    Returns string

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

Generated using TypeDoc