DateGalleryEvent<T>

CLASS

A DateGalleryEvent represents things like birthdays, meetings doctors appointments etc etc inside of a DateGallery.

A DateGalleryEvent keeps track of the events start and end date.

Custom pieces of information can be found in the data property, which can be anything you'd like, from an object to a string. For example you could store the title and description of the event there.

The overlapsWith property will tell you all the events that this event currently overlaps with.

You should never instantiate a DateGalleryEvent directly, instead you should call addEvent on the DateGallery and provide a DateGalleryEventConfig from which the DateGalleryEvent is instantiated.

Alternatively you can also provide events via the DateGalleryConfigs events property.

Since 1.6.0

Constructor

Creates an DateGalleryEvent which belongs to the given DateGallery.

Note: you should never create instances of DateGalleryEvent yourself. You are supposed to let DateGallery do this for you.

Since 1.6.0

Signature

constructor(
dateGallery : DateGallery<T> ,
data : T ,
startDate : Date ,
endDate : Date
): DateGalleryEvent<T>

Parameters

dateGallery: DateGallery<T>

The DateGallery this DateGalleryEvent belongs to.

data: T

The data of this DateGalleryEvent

startDate: Date

endDate: Date

Properties

  • data

    T

    The data for this event, "data" can be be anything from an object, string, array etc etc. It is used to pass along data to the event you might need to display the event, such as the text for the event.

    By default the value is undefined.

    Since 1.6.0

  • dateGallery

    DateGallery<T>

    Reference to the DateGallery is it a part of.

    Since 1.6.0

  • endDate

    Date

    The end date of the event, includes the time.

    The endDate is inclusive: meaning if the event has a startDate which is monday and an endDate on wednesday, the event runs on monday, tuesday and wednesday.

    Since 1.6.0

  • isOverlapping

    boolean

    Whether or not this DateGalleryEvent overlaps with other events.

    Since 1.6.0

  • overlappingEvents

    DateGalleryEvent<T> []

    The other events in the DateGallery this event overlaps with.

    Since 1.6.0

  • spansMultipleDays

    boolean

    Whether or not this events spans over multiple days.

    Is false when the startDate and endDate are on the same day, is true when the startDate and endDate are on different days.

    Since 1.6.0

  • startDate

    Date

    The start date of the event, includes the time.

    The startDate is inclusive: meaning if the event has a startDate which is monday and an endDate on wednesday, the event runs on monday, tuesday and wednesday.

    Since 1.6.0

Methods

  • changeData

    Changes the data of this DateGalleryEvent, and informs the subscribers of the change.

    Note: if you provide the exact same data it will still set the data and inform the subscribers, even though nothing has actually changed.

    This way, when data is an object or an array, you can mutate the object / array directly, and pass in the same data object to the changeData, without having to create copies.

    Since 1.6.0

    Signature

    changeData(
    data : T
    ): void

    Parameters

    data: T

    The new data for this DateGalleryEvent

  • move

    Moves this DateGalleryEvent chronologically, or in other words it changes the events start and end time to the given range.

    Since 1.6.0

    Signature

    move( ): void

    Parameters

    range: DateGalleryRange

    The new start and end times of the event.

    Throws

    DateGalleryEventInvalidRangeError an events start date must lie before on on the end date.

    DateGalleryEventNotFoundError the provided event must be part of the DateGallery.

  • remove

    Removes this DateGalleryEvent from the DateGallery it belongs to.

    Since 1.6.0

    Signature

    remove(): void