Namespace: TimeUtils

Oracle® JavaScript Extension Toolkit (JET)
7.1.0

F18183-01

QuickNav


TimeUtils

Version:
  • 7.1.0
Since:
  • 2.1.0
Module:
  • ojtimeutils

Module usage

See JET Module Loading for an overview of module usage within JET.

Javascript Import Format
define(['ojs/ojtimeutils'], function(TimeUtils) {
 // Application should call API on TimeUtils 
})
Typescript Import Format
//This namespace exports multiple static methods or members. To import 
import * as TimeUtils from "ojtimeutils";

//Now you can access the methods as TimeUtils.methodName and so on

JET In Typescript

A detailed description of working with JET elements and classes in your typescript project can be found at: JET Typescript Usage.

Description

This class provides functions related to time to position conversions and vice versa.

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
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" div>
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
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" td>
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
Returns:
the position of the time relative to the width of the time range.
Type
number