EventDayIndex

This utility class is used by event stores to index events by their day (a "YYYY-MM-DD" value, also known as a "date key"). This key is produced by a DayTime instance. If two DayTime instances have a common startShift, they can share an index.

Properties

1
dayTime: DayTimereadonly

The DayTime definition for this index. This is set to the initial DayTime instance but can be used for any other registered DayTime instances since they all posses the same value for startShift.

This defaults to MIDNIGHT.

Functions

5

Clear this index.

Returns an object that has properties named by the dateKey method, or the array of event records if a date is specified, or the event record array and the date key in a 2-element array if returnKey is true.

ParameterTypeDescription
indexNameString

The name of the desired index (either 'date' or 'startDate').

dateNumber | Date

The date as a Date or the millisecond UTC epoch. When passed, this method will return the array of event records for this date.

returnKeyBoolean

Specify true to return the date key along with the event record array.

Returns: Object | EventModel[]

Returns true if the given dayTime matches this index.

ParameterTypeDescription
dayTimeDayTime
Returns: Boolean

This method registers a dayTime instance with this index in the users array.

ParameterTypeDescription
dayTimeDayTime

The instance to register.

This method unregisters a dayTime instance, removing it from the users array. This method returns true if this was the last registered instance and this index is no longer needed.

ParameterTypeDescription
dayTimeDayTime

The instance to register.

Returns: Boolean