Fix clock flickering on main page — inline updateHeaderClock was using UTC

The updateHeaderClock function in index.html was inlined and still using
raw UTC (toISOString), while nav.html's version used InterceptTime.
Both ran on 1-second intervals updating the same element, causing the
clock to rapidly alternate between ET and UTC.

Fix: Updated the inline version in index.html to use InterceptTime,
matching nav.html. Added _navClockStarted guard and onChange listener
so only one interval runs and timezone changes apply instantly.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
mitchross
2026-03-26 01:15:28 -04:00
parent 6de443e833
commit 3aadaf1c86
+14 -4
View File
@@ -3816,11 +3816,17 @@
keywords: [] keywords: []
}; };
// UTC Clock Update // Clock Update (uses global InterceptTime for timezone/format)
function updateHeaderClock() { function updateHeaderClock() {
const now = new Date(); const now = new Date();
const utc = now.toISOString().substring(11, 19); const el = document.getElementById('headerUtcTime');
document.getElementById('headerUtcTime').textContent = utc; const label = document.querySelector('.utc-label');
if (typeof InterceptTime !== 'undefined') {
if (el) el.textContent = InterceptTime.fullTime(now);
if (label) label.textContent = InterceptTime.getLabel() || 'LOCAL';
} else {
if (el) el.textContent = now.toISOString().substring(11, 19);
}
} }
function setActiveModeIndicator(label) { function setActiveModeIndicator(label) {
@@ -3855,8 +3861,12 @@
} }
// Update clock every second // Update clock every second
window._navClockStarted = true;
setInterval(updateHeaderClock, 1000); setInterval(updateHeaderClock, 1000);
updateHeaderClock(); // Initial call updateHeaderClock();
if (typeof InterceptTime !== 'undefined' && InterceptTime.onChange) {
InterceptTime.onChange(updateHeaderClock);
}
applyKeyboardAccessibility(); applyKeyboardAccessibility();
// Pager message filter functions // Pager message filter functions