16 lines
266 B
JavaScript
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
|
|
} |