Options
All
  • Public
  • Public/Protected
  • All
Menu

The calendar for project scheduling, it is used to mark certain time intervals as "non-working" and ignore them during scheduling.

The calendar consists from several intervals. The intervals can be either static or recurrent.

tier

enterprise

tier-for-gantt

core

Hierarchy

Index

Properties

$project

The project instance, this entity belongs to.

cls

cls: string

A CSS class to add to non-working time elements rendered in the UI

graph

graph: Replica

A reference to the graph, this entity belongs to. Initially empty, and is populated when the entity instance is added to the replica (Replica.addEntity)

iconCls

iconCls: string

A CSS class defining an icon to display inside non-working time elements rendered in the UI

ignoreTimeZone

ignoreTimeZone: boolean

If set to true, the calendar will ignore the project current timeZone setting. Used in the default "weekends" calendar

name

name: string

The calendar name

project

The project instance, this entity belongs to.

treatInconsistentIntervals

treatInconsistentIntervals: TreatInconsistentIntervals

A flag indicating how to treat invalid intervals produced by recurrence start/end rules. The recurrences could be misconfigured, producing unmatched start and end date instances.

The field supports the following set of values:

  • [TreatInconsistentIntervals.Skip Skip] - skip such intervals silently (default)
  • [TreatInconsistentIntervals.Throw Throw] - throw an exception when facing such invalid interval

unspecifiedTimeIsWorking

unspecifiedTimeIsWorking: boolean

The flag, indicating, whether the "unspecified" time (time that does not belong to any interval) is working (true) or not (false). Default value is true

usedBy

usedBy: Set<HasCalendarMixin>

Entities using the calendar (project, events, resources etc)

Accessors

$

  • get $(): {}
  • An object, which properties corresponds to the ChronoGraph Identifiers, created for every field.

    For example:

    class Author extends Entity.mix(Base) {
        @field()
        firstName       : string
        @field()
        lastName        : string
    }
    
    const author = Author.new()
    
    // identifier for the field `firstName`
    author.$.firstName
    
    const firstName = replica.read(author.$.firstName)

    Returns {}

$$

  • A graph identifier, that represents the whole entity.

    Returns EntityIdentifier

$entity

  • An EntityMeta instance, representing the "meta" information about the entity class. It is shared among all instances of the class.

    Returns EntityMeta

dateHelper

  • get dateHelper(): any
  • Returns the timezone-aware date helper if the project has one configured, otherwise returns the static DateHelper class.

    internal

    Returns any

Static $entity

  • An EntityMeta instance, representing the "meta" information about the entity class. It is shared among all instances of the class.

    Returns EntityMeta

Methods

accumulateWorkingTime

  • This method starts at the given date and moves forward or backward in time, depending on isForward. It stops moving as soon as it accumulates the durationMs milliseconds of working time and returns the date at which it has stopped and remaining duration - the AccumulateWorkingTimeResult object.

    Normally, the remaining duration will be 0, indicating the full durationMs has been accumulated. However, sometimes, calendar might not be able to accumulate enough working time due to various reasons, like if it does not contain enough working time - this case will be indicated with remaining duration bigger than 0.

    Parameters

    • date: Date
    • durationMs: Duration
    • isForward: boolean

    Returns AccumulateWorkingTimeResult

addInterval

addIntervals

calculateDurationMs

  • calculateDurationMs(startDate: Date, endDate: Date, allowNegative?: Boolean): Duration
  • Calculate the working time duration between the 2 dates, in milliseconds.

    Parameters

    • startDate: Date
    • endDate: Date
    • Default value allowNegative: Boolean = false

    Returns Duration

calculateEndDate

  • calculateEndDate(startDate: Date, durationMs: Duration): Date | null
  • Calculate the end date of the time interval which starts at startDate and has durationMs working time duration (in milliseconds).

    Parameters

    Returns Date | null

calculateStartDate

  • calculateStartDate(endDate: Date, durationMs: Duration): Date | null
  • Calculate the start date of the time interval which ends at endDate and has durationMs working time duration (in milliseconds).

    Parameters

    Returns Date | null

clearIntervals

  • clearIntervals(silent?: boolean): boolean
  • This method removes all intervals from the internal collection of the calendar

    Parameters

    • Optional silent: boolean

    Returns boolean

commit

  • This is a convenience method, that just delegates to the ChronoGraph.commit method of this entity's graph.

    If there's no graph (entity has not been added to any replica) a CommitZero constant will be returned.

    Parameters

    Returns CommitResult

commitAsync

  • This is a convenience method, that just delegates to the ChronoGraph.commitAsync method of this entity's graph.

    If there's no graph (entity has not been added to any replica) a resolved promise with CommitZero constant will be returned.

    Parameters

    Returns Promise<CommitResult>

enterGraph

  • enterGraph(replica: Replica): void
  • This method is called when entity is added to some replica.

    Parameters

    Returns void

forEachAvailabilityInterval

  • forEachAvailabilityInterval(options: { endDate?: Date; isForward?: boolean; maxRange?: number; startDate?: Date }, func: (startDate: Date, endDate: Date, calendarCacheInterval: CalendarCacheInterval) => any, scope?: object): CalendarIteratorResult
  • The core iterator method of the calendar.

    Parameters

    • options: { endDate?: Date; isForward?: boolean; maxRange?: number; startDate?: Date }

      The options for iterator. Should contain at least one of the startDate/endDate properties which indicates what timespan to examine for availability intervals. If one of boundaries is not provided iterator function should return false at some point, to avoid infinite loops.

      Another recognized option is isForward, which indicates the direction in which to iterate through the timespan.

      • Optional endDate?: Date
      • Optional isForward?: boolean
      • Optional maxRange?: number
      • Optional startDate?: Date
    • func: (startDate: Date, endDate: Date, calendarCacheInterval: CalendarCacheInterval) => any

      The iterator function to call. It will be called for every distinct set of availability intervals, found in the given timespan. All the intervals, which are "active" for current interval are collected in the 3rd argument for this function - calendarCacheInterval. If iterator returns false (checked with ===) the iteration stops.

    • Optional scope: object

      The scope (this value) to execute the iterator in.

    Returns CalendarIteratorResult

getAssignmentById

  • getAssignmentById(id: ModelId): this["project"]["assignmentStore"]["modelInstanceT"]
  • Convenience method to get the instance of assignment by its id.

    Parameters

    • id: ModelId

    Returns this["project"]["assignmentStore"]["modelInstanceT"]

getAssignmentStore

  • getAssignmentStore(): this["project"]["assignmentStore"]
  • Convenience method to get the instance of the assignment store in the project instance, this entity belongs to.

    Returns this["project"]["assignmentStore"]

getCalendarById

  • getCalendarById(id: ModelId): this["project"]["calendarManagerStore"]["modelInstanceT"]
  • Convenience method to get the instance of calendar by its id.

    Parameters

    • id: ModelId

    Returns this["project"]["calendarManagerStore"]["modelInstanceT"]

getCalendarManagerStore

  • getCalendarManagerStore(): this["project"]["calendarManagerStore"]
  • Convenience method to get the instance of the calendar manager store in the project instance, this entity belongs to.

    Returns this["project"]["calendarManagerStore"]

getDependencyById

  • getDependencyById(id: ModelId): this["project"]["dependencyStore"]["modelInstanceT"]
  • Convenience method to get the instance of dependency by its id.

    Parameters

    • id: ModelId

    Returns this["project"]["dependencyStore"]["modelInstanceT"]

getDependencyStore

  • getDependencyStore(): this["project"]["dependencyStore"]
  • Convenience method to get the instance of the dependency store in the project instance, this entity belongs to.

    Returns this["project"]["dependencyStore"]

getEventById

  • getEventById(id: ModelId): this["project"]["eventStore"]["modelInstanceT"]
  • Convenience method to get the instance of event by its id.

    Parameters

    • id: ModelId

    Returns this["project"]["eventStore"]["modelInstanceT"]

getEventStore

  • getEventStore(): this["project"]["eventStore"]
  • Convenience method to get the instance of the event store in the project instance, this entity belongs to.

    Returns this["project"]["eventStore"]

getGraph

getNonWorkingTimeRanges

  • getNonWorkingTimeRanges(startDate: Date, endDate: Date, maxRange?: number): { endDate: Date; startDate: Date }[]
  • Returns non-working time ranges between the provided dates.

    Parameters

    • startDate: Date

      Start of the period to get ranges from.

    • endDate: Date

      End of the period to get ranges from.

    • Optional maxRange: number

    Returns { endDate: Date; startDate: Date }[]

getProject

  • getProject(): this["project"]

getResourceById

  • getResourceById(id: ModelId): this["project"]["resourceStore"]["modelInstanceT"]
  • Convenience method to get the instance of resource by its id.

    Parameters

    • id: ModelId

    Returns this["project"]["resourceStore"]["modelInstanceT"]

getResourceStore

  • getResourceStore(): this["project"]["resourceStore"]
  • Convenience method to get the instance of the resource store in the project instance, this entity belongs to.

    Returns this["project"]["resourceStore"]

getWorkingTimeRanges

  • getWorkingTimeRanges(startDate: Date, endDate: Date, maxRange?: number): { endDate: Date; startDate: Date }[]
  • Returns working time ranges between the provided dates.

    Parameters

    • startDate: Date

      Start of the period to get ranges from.

    • endDate: Date

      End of the period to get ranges from.

    • Optional maxRange: number

    Returns { endDate: Date; startDate: Date }[]

isWorkingTime

  • isWorkingTime(startDate: Date, endDate?: Date, fullyContained?: boolean): boolean
  • Checks if there is a working time interval in the provided time range (or when just startDate is provided, checks if the date is contained inside a working time interval in this calendar)

    Parameters

    • startDate: Date
    • Optional endDate: Date
    • Optional fullyContained: boolean

    Returns boolean

joinProject

  • joinProject(): void

leaveGraph

  • This method is called when entity is removed from the replica it's been added to.

    Parameters

    Returns void

leaveProject

  • leaveProject(isReplacing?: boolean): void

removeInterval

removeIntervals

setProject

  • setProject(project: this["project"]): this["project"]
  • The method to set the project instance, this entity belongs to.

    Parameters

    • project: this["project"]

    Returns this["project"]

skipNonWorkingTime

  • skipNonWorkingTime(date: Date, isForward?: boolean): Date | null | "empty_calendar"
  • Returns the earliest point at which a working period of time starts, following the given date. Can be the date itself, if it comes on the working time.

    Parameters

    • date: Date

      The date after which to skip the non-working time.

    • Default value isForward: boolean = true

      Whether the "following" means forward in time or backward.

    Returns Date | null | "empty_calendar"

userProvidedValue

Generated using TypeDoc