forceCalendar
API Reference

RecurrenceEngine

API reference for the RecurrenceEngine static class.

import { RecurrenceEngine } from '@forcecalendar/core';

All methods are static.

Methods

MethodSignatureReturns
expandEvent(event, rangeStart: Date, rangeEnd: Date, maxOccurrences?: number, tz?: string) => Event[]Occurrence array
parseRule(ruleString: string) => objectParsed rule
getNextOccurrence(currentDate: Date, rule: object, tz?: string) => DateNext date
matchesByDay(date: Date, byDay: string[]) => booleanDay match
setToWeekdayOfMonth(date: Date, weekday: string, position: number) => DateAdjusted date
isException(date: Date, rule: object, eventId?: string) => booleanIs exception
addExceptions(rule: object, exceptions: Date[], options?: object) => void
getDescription(rule: object) => stringHuman-readable

expandEvent Parameters

ParamTypeDefaultDescription
eventEventrequiredThe recurring event
rangeStartDaterequiredStart of expansion range
rangeEndDaterequiredEnd of expansion range
maxOccurrencesnumber365Safety limit
timezonestringundefinedIANA timezone

Occurrence Object Shape

Each expanded occurrence has:

PropertyTypeDescription
...eventAll properties from original event
startDateAdjusted start for this occurrence
endDateAdjusted end for this occurrence
isOccurrencebooleanAlways true
originalEventIdstringID of the recurring event
occurrenceDateDateDate of this occurrence