Spaces:
Running
Running
fix: add local time display for backup timestamp in renderDashboard function
Browse files- health-server.js +11 -0
health-server.js
CHANGED
|
@@ -461,6 +461,9 @@ function renderDashboard(data) {
|
|
| 461 |
value: toneBadge(syncStatus.toUpperCase(), syncTone),
|
| 462 |
detail: backupDetail,
|
| 463 |
tone: syncTone,
|
|
|
|
|
|
|
|
|
|
| 464 |
}),
|
| 465 |
renderTile({
|
| 466 |
title: "Keep Awake",
|
|
@@ -532,6 +535,14 @@ function renderDashboard(data) {
|
|
| 532 |
</section>
|
| 533 |
<footer><span class="live">Live</span> status - Health endpoint: <code>/health</code></footer>
|
| 534 |
</main>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 535 |
</body>
|
| 536 |
</html>`;
|
| 537 |
}
|
|
|
|
| 461 |
value: toneBadge(syncStatus.toUpperCase(), syncTone),
|
| 462 |
detail: backupDetail,
|
| 463 |
tone: syncTone,
|
| 464 |
+
meta: data.backup?.timestamp
|
| 465 |
+
? `<span class="local-time" data-iso="${data.backup.timestamp}"></span>`
|
| 466 |
+
: "",
|
| 467 |
}),
|
| 468 |
renderTile({
|
| 469 |
title: "Keep Awake",
|
|
|
|
| 535 |
</section>
|
| 536 |
<footer><span class="live">Live</span> status - Health endpoint: <code>/health</code></footer>
|
| 537 |
</main>
|
| 538 |
+
<script>
|
| 539 |
+
document.querySelectorAll('.local-time').forEach(el => {
|
| 540 |
+
const date = new Date(el.getAttribute('data-iso'));
|
| 541 |
+
if (!isNaN(date)) {
|
| 542 |
+
el.textContent = 'At ' + date.toLocaleTimeString();
|
| 543 |
+
}
|
| 544 |
+
});
|
| 545 |
+
</script>
|
| 546 |
</body>
|
| 547 |
</html>`;
|
| 548 |
}
|