Class: TimeUtils

Oracle® JavaScript Extension Toolkit (JET)
3.2.0

E87541-01

QuickNav

oj. TimeUtils

Version:
  • 3.2.0
Since:
  • 2.1.0
This class provides functions related to time to position conversions and vice versa.

Constructor

new TimeUtils()

Source:

Methods

<static> getDate(pos, rangeStartTime, rangeEndTime, rangeWidth) → {number}

Calculates the date/time of a given position point relative to the width of a given time range.
Parameters:
Name Type Description
pos number the position of interest
rangeStartTime Date | string | number the lower bound of the time range of interest
rangeEndTime Date | string | number the upper bound of the time range of interest
rangeWidth number the width of the time range of interest
Source:
Returns:
the date in milliseconds since midnight Jan 1 1970 corresponding to the provided position and time range width.
Type
number

<static> getLength(startTime, endTime, rangeStartTime, rangeEndTime, rangeWidth) → {number}

Calculates the distance between two time points relative to the width of a given time range, e.g. useful for calculating the length of a task bar given the start and end time, and the time axis range and width. Expects rangeStartTime <= startTime <= endTime <= rangeEndTime.
Parameters:
Name Type Description
startTime Date | string | number the start time of interest
endTime Date | string | number the end time of interest
rangeStartTime Date | string | number the lower bound of the time range of interest
rangeEndTime Date | string | number the upper bound of the time range of interest
rangeWidth number the width of the time range of interest
Source:
Returns:
the distance between the startTime and endTime positions relative to the width of the time range.
Type
number

<static> getPosition(time, rangeStartTime, rangeEndTime, rangeWidth) → {number}

Calculates the position of a given time point relative to the width of a given time range, e.g. useful for calculating the start position of a task bar based on its start time and the given time axis range and width.
Parameters:
Name Type Description
time Date | string | number the time point of interest, where rangeStartTime <= time <= rangeEndTime
rangeStartTime Date | string | number the lower bound of the time range of interest
rangeEndTime Date | string | number the upper bound of the time range of interest
rangeWidth number the width of the time range of interest
Source:
Returns:
the position of the time relative to the width of the time range.
Type
number