v7.3.0
SupportExamplesFree Trial

RecurringTimeSpan
Mixin

This mixin class provides recurrence related fields and methods to a TimeSpan model. This class is used to support recurring events (and time ranges) in the Scheduler and Calendar components.

Data structure

The mixin introduces two types of timespans: the recurring timespan and its occurrences. A recurring timespan is a timespan having a recurrenceRule specified and its occurrences are "fake" dynamically generated timespans. You can also provide exceptionDates to the data to exclude certain dates. See sample data below,

{
    id: 7,
    startDate: '2021-10-12T14:00:00',
    endDate: '2021-10-12T15:00:00',
    name: 'Lunch',
    resourceId: 'hotel',
    recurrenceRule: 'FREQ=DAILY;COUNT=5',
    exceptionDates: ['2021-10-14']
}

Useful API methods

There are few methods allowing to distinguish a recurring event and an occurrence: isRecurring, isOccurrence and recurringTimeSpan (returns the event this record is an occurrence of).

The recurrence rule defined for the event is parsed and represented with RecurrenceModel class (can be changed by setting recurrenceModel property) instance. See: recurrence property.

To query the ocurrences for a specific timespan, use the getOccurrencesForDateRange method:

// Get all occurrences between Feb 1-10
timespan.getOccurrencesForDateRange(new Date(2024, 1, 1), new Date(2024, 1, 10));
No results

Fields

Fields belong to a Model class and define the Model data structure
  • The timespan recurrence rule. A string in RFC-5545 described format ("RRULE" expression).

Properties

Properties are getters/setters or publicly accessible variables on this class
  • isRecurringTimeSpan : Booleantrue
    READONLY
    ADVANCED
    Identifies an object as an instance of RecurringTimeSpan class, or subclass thereof.
  • isOccurrence : Boolean
    READONLY

    Indicates if the timespan is an occurrence of another recurring timespan.

  • isRecurring : Boolean
    READONLY

    Indicates if the timespan is recurring.

  • newExceptionDate : Date
    private
    READONLY

    The setter used by Model#inSet when addExceptionDate is called. Adding an exception must trigger change processing in a recurring event, so it must be changed through a set call. Also, the change must be batchable with other changes.

  • occurrenceDate : Date
    internal
    READONLY

    The original {@lScheduler.model.TimeSpan#field-startDate startDate} of this event before any modifications took place. Used by removeOccurrence and detachFromRecurringEvent

  • If this event is an occurrence of a recurring event, then this property yields its zero-based occurrence index in the sequence.

  • occurrenceMap : Map
    internal
    READONLY

    A Map, keyed by each date an occurrence intersects, of occurrences of this event.

  • The recurrence model used for the timespan.

  • Name of the class representing the recurrence model, defaults to RecurrenceModel

  • recurringTimeSpan : TimeSpan
    internal
    READONLY

    The "main" timespan this model is an occurrence of. For non-occurrences returns null.

  • Returns true if this timespan supports recurring.

Functions

Functions are methods available for calling on the class
    • Detaches an occurrence from its owning recurring event so that it can be added to the eventStore either as an exception, or as the start of a new recurring sequence.

    • onRecurrenceChanged( )
      internal

      The method is triggered when the timespan recurrence settings get changed. It updates the recurrenceRule field in this case.

    • remove( )

      Override of Model's method. If an isOccurrence is passed, it is detached from its parent recurring event. If it still has a recurrence then the recurring event is changed to stop at the occurrence date. If it has no recurrence an exception is added at the occurrence date.

    • removeOccurrences( )
      internal

      Removes this recurring timespan's cached occurrences.

    • Removes all cached occurrences on or after the passed date from this recurring timespan's cached occurrences.

    Source path

    Scheduler/model/mixin/RecurringTimeSpan.js

    Contents