getMillisecondsAgo()function

getMillisecondsAgo(target: PossibleDate, current?: PossibleDate, caller: AnyCaller = getMillisecondsAgo): number
ParamType
targetPossibleDate
Date to count back from. required
currentPossibleDate
Date to count to (defaults to now).
callerAnyCaller
Function to attribute a thrown error to (defaults to getMillisecondsAgo itself). Defaults to getMillisecondsAgo
Return
number
Number of milliseconds from target to current (negative if target is in the future).
Throws
RequiredError
If target or current cannot be converted to a valid date.

Count the milliseconds since a date.

Examples

getMillisecondsAgo("2000-01-01") // 833587200000