Module: caltime/timespan

Methods

(inner) calcBeginMs(inTimeSpan) → {number}

Get the inclusive begin time of a TimeSpan in milliseconds. This is the time elapsed since 00:00:00 (midnight) of the same day.
Parameters:
Name Type Description
inTimeSpan Object A valid TimeSpan object. An error if thrown if the object is not an instance of TimeSpan.
Source:
Throws:
Error
Returns:
Start time in [milliseconds].
Type
number

(inner) calcEndMs(inTimeSpan) → {number}

Get the exclusive end time of a TimeSpan in milliseconds. This is the time elapsed since 00:00:00 (midnight) of the same day.
Parameters:
Name Type Description
inTimeSpan Object A valid TimeSpan object. An error if thrown if the object is not an instance of TimeSpan.
Source:
Throws:
Error
Returns:
End time in [milliseconds].
Type
number

(inner) splitTime(inMilliseconds) → {Object}

Split the time of the day, when expressed in [milliseconds] into hours, minutes, seconds and milliseconds.
Parameters:
Name Type Description
inMilliseconds number Time of the day in milliseconds i.e. time elapsed since the previous midnight.
Source:
Returns:
An object with four data members, one each for the time component in hours, minutes, seconds and milliseconds.
Type
Object

(inner) timeSpan(inHours, inMinutes, inSeconds, inMilliseconds, inDurationMins, inDurationSecsopt, inDurationMsopt) → {object}

Functional constructor which creates an instance of a TimeSpan. Do not use with the 'new' operator. Each TimeSpan object is immutable. The inclusive end time of a timespan cannot exceed 23:59:59:999 i.e. the exclusive end time cannot exceed 12 midnight (00:00:00:000 of the following day). The total duration of a timespan is equal to: inDurationMins + inDurationSecs + inDurationMs
Parameters:
Name Type Attributes Default Description
inHours number Integer. Represents the 'hour of day' component of the start time of the timespan. Valid values are 0-23. An error is thrown if the integer is not specified or is not within the valid range.
inMinutes number Integer. Represents the minutes component of the start time of the timespan. Valid values are 0-59. An error is thrown if the integer is not specified or is not within the valid range.
inSeconds number Integer. Represents the seconds component of the start time of the timespan. Valid values are 0-59. An error is thrown if the integer is not specified or is not within the valid range.
inMilliseconds number Integer. Represents the milliseconds component of the start time of the timespan. Valid values are 0-999. An error is thrown if the integer is not specified or is not within the valid range.
inDurationMins number Positive integer representing the duration of the timespan in [minutes]. An error is thrown if this argument is not specified or it is not a valid, positive integer. Valid range is 0-1440.
inDurationSecs number <optional>
0 Positive integer representing the [seconds] component of the duration. An error is thrown if this argument is not specified or it is not a valid, positive integer. Valid range is 0-59.
inDurationMs number <optional>
0 Positive integer representing the [milliseconds] component of the duration. An error is thrown if this argument is not specified or it is not a valid, positive integer. Valid range is 0-999.
Source:
Returns:
A new instance of the TimeSpan object.
Type
object