MCPcopy Create free account
hub / github.com/UdaraJay/Stats / prettyPrintTimeDifference

Function prettyPrintTimeDifference

ui/script.js:47–56  ·  view source on GitHub ↗
(t1, t2)

Source from the content-addressed store, hash-verified

45}
46
47function prettyPrintTimeDifference(t1, t2) {
48 const d1 = new Date(t1),
49 d2 = new Date(t2);
50 if (isNaN(d1) || isNaN(d2)) return ["00", "00", "00"];
51 const s = (Math.abs(d2 - d1) / 1000) | 0;
52 const hh = (s / 3600) | 0;
53 const mm = ((s % 3600) / 60) | 0;
54 const ss = s % 60;
55 return [hh, mm, ss].map((n) => String(n).padStart(2, "0"));
56}
57
58function mapHourlyEventsToLocalTime(events) {
59 const now = new Date();

Callers 1

renderSessionsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected