# Recurrences

The CalendarRecurrence object specifies how often the event is supposed to occur. Some examples of this could be:

  • an event that occurs once every Friday
  • an event that occurs every other week
  • an event that occurs daily for five days

Recurrence is optional.

Note

This feature is not supported in Yahoo or Outlook online calendars.

# frequency

  • Type: string
  • Required: no
  • Valid value: any of DAILY, WEEKLY, MONTHLY, or YEARLY

The Julian interval of how often this event should occur. The interval (i.e., the time between recurrences) is dictated by interval.

# interval

  • Type: number
  • Required: no
  • Valid value: any positive integer

The amount of time that will occur between recurrences. The scale of the time depends on frequency.

Examples

  • An event that occurs once every day: { frequency: 'DAILY', interval: 1 }
  • An event that occurs once every second Friday: { frequency: 'WEEKLY', interval: 2 }
  • An event that occurs once every three months: { frequency: 'MONTHLY', interval: 3 }

# count

  • Type: number
  • Required: no
  • Valid value: any positive integer

The maximum number of times the event should repeat.

Important

If this parameter is specified in conjunction with end, the recurrence will end either when count is completed, or when end occurs, whichever happens first.

# end

The latest date that this event may occur on.

Important

If this parameter is specified in conjunction with count, the recurrence will end either when count is completed, or when end occurs, whichever happens first.

# weekdays

  • Type: string[]
  • Required: no
  • Valid value: an array containing any non-repeating strings of SU, MO, TU, WE, TH, FR or SA, optionally prefixed by an integer.

The days of the week that the event should occur on. The interval (i.e., the time between recurrences) is dictated by interval.

These days may be prefixed with a non-zero integer to represent the occurrence to fall on the nth day. Negative integers may be used to represent the nth last day. Defaults to 1 if no integer prefix is specified.

Examples

  • The first Sunday of the month: SU
  • The second Wednesday of the month: 2WE
  • The last Friday of the month: -1FR
  • The second-to-last Thursday of the month: -2TH

Important

  • The frequency parameter must be set to WEEKLY or MONTHLY for weekdays to take effect.
  • In MONTHLY mode, Yahoo! Calendar only supports one nonnegative weekday.

Caution when specifying weekdays using Yahoo! Calendar in MONTHLY mode

Only the first nonnegative nth-day(s) prefix is taken into account, and used for the rest of the days of the week specified.

For example, if you pass in ['2FR', '1TU'] (every second Friday and every first Tuesday), it would fall back to ['2FR', 'TU]` (every second Friday and every second Tuesday) instead.

# monthdays

  • Type: number[]
  • Required: no
  • Valid value: an array of any non-repeating, positive integers between 1 and 31

The days of the month that the event should occur on. The interval (i.e., the time between recurrences) is dictated by interval.

Important

  • The frequency parameter must be set to MONTHLY for monthdays to take effect.
  • Non-existent days (e.g., February 30) will be ignored.

# weekstart

The day of the week to denote when the the week starts on.

# Example with end-of-month skipping

An example where the days generated makes a difference because of weekstart:

{
  frequency: 'WEEKLY',
  interval: 2,
  count: 4,
  weekdays: ['TU', 'SU'],
  weekstart: 'MO'
}

This will generate a recurrence that occurs on August 5, 10, 19, and 24.

However, changing weekstart from MO to SU:

{
  frequency: 'WEEKLY',
  interval: 2,
  count: 4,
  weekdays: ['TU', 'SU'],
  weekstart: 'SU'
}

This will instead generate a recurrence that occurs on August 5, 10, 19, and 31.

# Example with invalid dates ignored

In the following example, the invalid date of February 30 will be ignored.

{
  frequency: 'MONTHLY',
  interval: 2,
  count: 4,
  monthdays: [15, 30],
  weekstart: 'SU'
}

This will generate recurrences on the following dates:

  • January 15 and 30
  • February 15
  • March 15, 30