Skip to content

Commit b671fbe

Browse files
authored
Update Battery-Runtime-Tests.md
1 parent 6d83781 commit b671fbe

File tree

1 file changed

+32
-2
lines changed

1 file changed

+32
-2
lines changed

Battery-Runtime-Tests.md

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,35 @@ title: Battery Runtime Tests
7777
if (days === 1) return `1 day ${hours} hrs`;
7878
return `${days} days ${hours} hrs`;
7979
}
80+
function convertHoursTextInCell(cell) {
81+
if (!cell) return;
82+
83+
// Only touch plain text cells (skip cells that contain <div>, <img>, etc)
84+
if (cell.children && cell.children.length > 0) return;
85+
86+
const txt = (cell.textContent || "").trim();
87+
88+
// Match: "104 Hrs", "53 Hr", "110 hours", etc
89+
const m = txt.match(/^(\d+)\s*(h|hr|hrs|hour|hours)$/i);
90+
if (!m) return;
91+
92+
const hours = parseInt(m[1], 10);
93+
if (Number.isNaN(hours)) return;
94+
95+
cell.textContent = formatDaysHours(hours);
96+
}
97+
98+
function updateStaticHourCells() {
99+
document.querySelectorAll("td, th").forEach(cell => {
100+
// Skip the dynamic progress cells (those become "Started ... ago")
101+
if (cell.id && cell.id.startsWith("progress")) return;
102+
103+
// Do not touch your "Started ..." strings if any exist elsewhere
104+
if ((cell.textContent || "").includes("Started")) return;
105+
106+
convertHoursTextInCell(cell);
107+
});
108+
}
80109
function updateProgress() {
81110
const startTimes = [
82111
{ id: 'progress1', start: new Date('2026-02-07T12:57:00') }, // L1 Eink 3000mAh NO GPS
@@ -342,11 +371,12 @@ title: Battery Runtime Tests
342371
});
343372
});
344373
}
345-
374+
346375
window.addEventListener("load", () => {
347376
buildGpsToggleHeaderRows();
348377
updateProgress();
349-
initPerPairGpsToggles();
378+
updateStaticHourCells(); // convert "104 Hrs" -> "4 days 8 hrs"
379+
initPerPairGpsToggles(); // cache AFTER conversion so toggles keep it
350380
});
351381

352382
setInterval(updateProgress, 3600000);

0 commit comments

Comments
 (0)