TimelineDateMapper

Configs

2

Dates

Gets/sets the current time resolution object, which contains a unit identifier and an increment count { unit, increment }. This value means minimal task duration you can create using UI.

For example when you drag create a task or drag & drop a task, if increment is 5 and unit is 'minute' that means that you can create tasks in 5 minute increments, or move it in 5 minute steps.

This value is taken from viewPreset timeResolution config by default. When supplying a Number to the setter only the increment is changed and the unit value remains untouched.

timeResolution : {
  unit      : 'minute',  //Valid values are "millisecond", "second", "minute", "hour", "day", "week", "month", "quarter", "year".
  increment : 5
}
When the fillTicks option is enabled, the resolution will be in full ticks regardless of configured value.
ParameterTypeDescription
incrementNumber

The increment in the specified unit

unitDurationUnit

The time resolution unit

Scheduled events

snap: Boolean= falseAlso a property

Set to true to snap to the current time resolution increment while interacting with scheduled events.

The time resolution increment is either determined by the currently applied view preset, or it can be overridden using timeResolution.

If you also want to snap to resources while dragging events, set the snapToResource config of the EventDrag feature to true.

When the fillTicks option is enabled, snapping will align to full ticks, regardless of the time resolution.

Properties

5

Class hierarchy

isTimelineDateMapper: Boolean= truereadonly
Identifies an object as an instance of TimelineDateMapper class, or subclass thereof.
isTimelineDateMapper: Boolean= truereadonlystatic
Identifies an object as an instance of TimelineDateMapper class, or subclass thereof.

Dates

Gets/sets the current time resolution object, which contains a unit identifier and an increment count { unit, increment }. This value means minimal task duration you can create using UI.

For example when you drag create a task or drag & drop a task, if increment is 5 and unit is 'minute' that means that you can create tasks in 5 minute increments, or move it in 5 minute steps.

This value is taken from viewPreset timeResolution config by default. When supplying a Number to the setter only the increment is changed and the unit value remains untouched.

timeResolution : {
  unit      : 'minute',  //Valid values are "millisecond", "second", "minute", "hour", "day", "week", "month", "quarter", "year".
  increment : 5
}
When the fillTicks option is enabled, the resolution will be in full ticks regardless of configured value.
ParameterTypeDescription
incrementNumber

The increment in the specified unit

unitDurationUnit

The time resolution unit

viewportCenterDate: Datereadonly

Returns the center date of the currently visible timespan of scheduler.

Scheduled events

snap: Boolean= falseAlso a config

Set to true to snap to the current time resolution increment while interacting with scheduled events.

The time resolution increment is either determined by the currently applied view preset, or it can be overridden using timeResolution.

If you also want to snap to resources while dragging events, set the snapToResource config of the EventDrag feature to true.

When the fillTicks option is enabled, snapping will align to full ticks, regardless of the time resolution.

Functions

6

Dates

Gets the x or y coordinate relative to the scheduler element, or page coordinate (based on the 'local' flag) If the coordinate is not in the currently rendered view, -1 will be returned.

ParameterTypeDescription
dateDate | Number

the date to query for (or a date as ms)

optionsBoolean | Object

true to return a coordinate local to the scheduler view element (defaults to true),

options.localBoolean

true if coordinate should be local to the time axis, or false to be a page coordinate

Returns: Number -

the x or y position representing the date on the time axis

Gets the date for an X or Y coordinate, either local to the view element or the page based on the 3rd argument. If the coordinate is not in the currently rendered view, null will be returned unless the allowOutOfRange parameter is passed a true.

ParameterTypeDescription
coordinateNumber

The X or Y coordinate

roundingMethodfloor | round | ceil

Rounding method to use. 'floor' to take the tick (lowest header in a time axis) start date, 'round' to round the value to nearest increment or 'ceil' to take the tick end date

localBoolean

true if the coordinate is local to the scheduler view element

allowOutOfRangeBoolean

By default, this returns null if the position is outside of the time axis. Pass true to attempt to calculate a date outside of the time axis.

Returns: Date -

The Date corresponding to the X or Y coordinate

Gets the time for a DOM event such as 'mousemove' or 'click' regardless of the orientation of the time axis.

ParameterTypeDescription
eEvent

the Event instance

roundingMethodfloor | round | ceil

Rounding method to use. 'floor' to take the tick (lowest header in a time axis) start date, 'round' to round the value to nearest increment or 'ceil' to take the tick end date

allowOutOfRangeBoolean

By default, this returns null if the position is outside of the time axis. Pass true to attempt to calculate a date outside of the time axis.

Returns: Date -

The date corresponding to the EventObject's position along the orientation of the time axis.

Gets the date for an XY coordinate regardless of the orientation of the time axis.

ParameterTypeDescription
xyArray

The page X and Y coordinates

roundingMethodfloor | round | ceil

Rounding method to use. 'floor' to take the tick (lowest header in a time axis) start date, 'round' to round the value to nearest increment or 'ceil' to take the tick end date

localBoolean

true if the coordinate is local to the scheduler element

allowOutOfRangeBoolean

By default, this returns null if the position is outside of the time axis. Pass true to attempt to calculate a date outside of the time axis.

Returns: Date -

the Date corresponding to the xy coordinate

Returns the distance in pixels for the time span in the view.

ParameterTypeDescription
startDateDate

The start date of the span

endDateDate

The end date of the span

Returns: Number -

The distance in pixels

Other

Gets the start and end dates for an element Region

ParameterTypeDescription
rectRectangle

The rectangle to map to start and end dates

roundingMethodfloor | round | ceil

Rounding method to use. 'floor' to take the tick (lowest header in a time axis) start date, 'round' to round the value to nearest increment or 'ceil' to take the tick end date

durationNumber

The duration in MS of the underlying event

Returns: Object -

an object containing start/end properties