Class: AgeIn

time_helpers~AgeIn()

Helper class for computing age differences in various units.

Constructor

new AgeIn()


Methods

(static) hours(startTime, endTimeopt) → {number}

Hours of difference between a given time and either now or an optional end time.
Parameters:
Name Type Attributes Description
startTime DateArg The time to calculate the age from.
endTime DateArg <optional>
Optional end time to calculate the age to (defaults to now)
Returns:
The age in hours, or a negative number if the start time is invalid.
Type
number

(static) minutes(startTime, endTimeopt) → {number}

Minutes of difference between a given time and either now or an optional end time.
Parameters:
Name Type Attributes Description
startTime DateArg The time to calculate the age from.
endTime DateArg <optional>
Optional end time to calculate the age to (defaults to now)
Returns:
The age in milliseconds, or a negative number if the start time is invalid.
Type
number

(static) ms(startTime, endTimeopt) → {number}

Milliseconds of difference between a given time and either now or an optional end time.
Parameters:
Name Type Attributes Description
startTime DateArg The time to calculate the age from.
endTime DateArg <optional>
Optional end time to calculate the age to (defaults to now)
Returns:
The age in milliseconds, or -1 if the start time is invalid.
Type
number

(static) seconds(startTime, endTimeopt) → {number}

Seconds of difference between a given time and either now or an optional end time.
Parameters:
Name Type Attributes Description
startTime DateArg The time to calculate the age from.
endTime DateArg <optional>
Optional end time to calculate the age to (defaults to now)
Returns:
The age in seconds, or a negative number if the start time is invalid.
Type
number