Skip to main content

estimateInstanceCount

API Docs


Function: estimateInstanceCount()

estimateInstanceCount(rule, estimationWindowMonths): number

Defined in: src/utilities/recurringEventHelpers.ts:217

Estimates the total number of instances that will be generated by a recurrence rule. If the rule is based on a count, it returns the count. If it's based on an endDate, it calculates the number of occurrences. For never-ending events, it estimates the number of instances over a specified time window (default is 12 months).

Parameters

rule

The recurrence rule to estimate.

baseRecurringEventId

string

byDay

string[] | null

byMonth

number[] | null

byMonthDay

number[] | null

count

number | null

createdAt

Date

creatorId

string

frequency

"DAILY" | "WEEKLY" | "MONTHLY" | "YEARLY"

id

string

interval

number

latestInstanceDate

Date

organizationId

string

originalSeriesId

string | null

recurrenceEndDate

Date | null

recurrenceRuleString

string

recurrenceStartDate

Date

updatedAt

Date | null

updaterId

string | null

estimationWindowMonths

number = 12

The number of months to use for estimation if the event is never-ending.

Returns

number

The estimated total number of instances.