utils/ts-src/toHour.ts

15 lines
401 B
TypeScript
Raw Normal View History

2020-11-17 11:16:34 +00:00
/**
* Return the number of Milliseconds to the hour for the supplied timestamp
* @param currentTimsestamp
* @param extra
* @returns {number}
* *
* @signature
* U.toHour(currentTimsestamp, extra)
* @example
* U.toHour('13:00') // => 1605532173
*/
export function toHour(currentTimsestamp: number, extra: number = 0): number {
return 3600000 - (currentTimsestamp % 3600000) + extra;
}