TimeSpan
This class represent a simple date range. It is being used in various subclasses and plugins which operate on date ranges.
It's a subclass of Model. Please refer to documentation of those classes to become familiar with the base interface of this class.
A TimeSpan has the following fields:
- startDate - start date of the task in the ISO 8601 format
- endDate - end date of the task in the ISO 8601 format (not inclusive)
- duration - duration, time between start date and end date
- durationUnit - unit used to express the duration
- name - an optional name of the range
- cls - an optional CSS class to be associated with the range.
The data source of any field can be customized in the subclass. Please refer to Model for details. To specify another date format:
class MyTimeSpan extends TimeSpan {
static get fields() {
{ name: 'startDate', type: 'date', dateFormat: 'DD/MM/YY' }
}
}
Useful configs and functions
| Member | Description |
|---|---|
| startDate | Start date of the time span |
| endDate | End date of the time span |
| duration | Duration magnitude |
| durationUnit | Duration unit (day, hour, etc.) |
| name | Display name |
| cls | CSS class to add to the rendered element |
| style | Inline CSS style string for the element |
See also
- EventModel - Event model (extends TimeSpan)
- TimeRangeModel - Time range model
- ResourceTimeRangeModel - Resource time range model
Fields
Fields belong to a Model class and define the Model data structure-
The name of the time span (or Event / Task)
-
The numeric part of the timespan's duration (the number of units).
-
Calculated field which encapsulates the duration's magnitude and unit. This field will not be persisted, setting it will update the duration and durationUnit fields.
-
CSS class specifying an icon to apply to the rendered time span element. Note: In case event is a milestone, using
iconClswith dependency feature might slightly decrease performance because feature will refer to the DOM to get exact size of the element. -
A CSS style string (applied to
style.cssText) or object (applied tostyle)record.style = 'color: red;font-weight: 800';
Properties
Properties are getters/setters or publicly accessible variables on this class-
Identifies an object as an instance of TimeSpan class, or subclass thereof.
-
Identifies an object as an instance of TimeSpan class, or subclass thereof.
-
Returns the event store this event is part of, if any.
-
Returns the WBS code of this model (e.g '2.1.3'). Only relevant when part of a tree store, as in the Gantt chart.
-
Returns an array of dates in this range. If the range starts/ends not at the beginning of day, the whole day will be included.
-
Returns the duration of this Event in milliseconds.
-
Returns true if record is a milestone.
-
Checks if the range record has both start and end dates set and start <= end
-
Returns the event raw duration in milliseconds. Calculated as a simple distance between the event start and end dates in milliseconds. And thus this value (in Scheduler Pro and Gantt) doesn't take into account non-working time nor the project conversion rates.