utils/ts-src/hourFloor.ts
Martin Donnelly c30b36b3f6 init
2020-11-17 11:16:34 +00:00

13 lines
303 B
TypeScript

/**
* Get the hour floor as a Base 32 string
* @param timestamp The timestamp as a number
* @returns {string}
*
* @example
* U.hourFloor(1605532173) // => '1fnp540'
*/
export function hourFloor(timestamp: number): string {
return (Math.floor(timestamp / 3600000) * 3600000).toString(32);
}