Generic Commit; Most likely a fix or small feature

This commit is contained in:
Darius
2025-11-18 01:03:24 +01:00
parent 5afb0e243d
commit 32c21f82eb
7 changed files with 37 additions and 2 deletions

8
dist/timehelper.js vendored
View File

@@ -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));