mirror of
https://github.com/datahub-project/datahub.git
synced 2025-07-28 11:59:54 +00:00
16 lines
416 B
TypeScript
16 lines
416 B
TypeScript
import { helper } from '@ember/component/helper';
|
|
|
|
/**
|
|
* Turns a timestamp given in ms to a unix time (as seconds)
|
|
* @param {number | string} timestamp - the given timestamp in ms
|
|
*/
|
|
export function msTimeAsUnix([timestamp]: [number | string]): number {
|
|
if (typeof timestamp === 'string') {
|
|
timestamp = parseInt(timestamp);
|
|
}
|
|
|
|
return Math.ceil(timestamp / 1000);
|
|
}
|
|
|
|
export default helper(msTimeAsUnix);
|