Usage
Typescript Import Format
//This namespace exports multiple static methods or members. To import
import * as TimeUtils from "ojs/ojtimeutils";
//Now you can access the methods as TimeUtils.methodName and so on
For additional information visit:
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
-
(static) .getWeekendReferenceObjects(start, end) : {Array.<oj.ojGantt.ReferenceObject>}
-
Calculates reference objects representing all weekends between the given start and end dates.
Parameters:
Name Type Description start
string The start date in ISO string format. end
string The end date in ISO string format. Returns:
Reference objects representing all weekends between the given start and end dates.
- Type
- Array.<oj.ojGantt.ReferenceObject>