fritzfix/libs/timediff.js
2024-06-12 10:26:04 +02:00

16 lines
266 B
JavaScript

function inMilliseconds(timestamp) {
if (!timestamp) {
return 0;
}
return Date.now() - timestamp;
}
function inSeconds(timestamp) {
return inMilliseconds(timestamp) / 1000;
}
// exports
module.exports = {
inMilliseconds,
inSeconds
}