Generic Commit; Most likely a fix or small feature
This commit is contained in:
8
dist/timehelper.js
vendored
8
dist/timehelper.js
vendored
@@ -1,6 +1,7 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.TimeSpan = void 0;
|
||||
exports.calculateSecondsBetween = calculateSecondsBetween;
|
||||
exports.secondsToReadable = secondsToReadable;
|
||||
class TimeSpan {
|
||||
constructor(timeSpanStr) {
|
||||
@@ -28,6 +29,13 @@ class TimeSpan {
|
||||
}
|
||||
}
|
||||
exports.TimeSpan = TimeSpan;
|
||||
function calculateSecondsBetween(start, end) {
|
||||
const seconds = Math.max(60, (end - start) / 1000);
|
||||
return {
|
||||
seconds,
|
||||
toReadable: (roundToMinutes) => secondsToReadable(seconds, roundToMinutes),
|
||||
};
|
||||
}
|
||||
function secondsToReadable(secs, roundToMinutes = false) {
|
||||
const totalSeconds = roundToMinutes ? Math.round(secs / 60) * 60 : secs;
|
||||
var days = Math.floor(totalSeconds / (3600 * 24));
|
||||
|
||||
Reference in New Issue
Block a user