From 978d1c085903d82ebbc09d8193d831160a5c566d Mon Sep 17 00:00:00 2001 From: Ole-Morten Duesund Date: Mon, 1 Sep 2025 11:19:02 +0200 Subject: [PATCH] fix: Correct UTC and Last Update clock display issues MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes incorrect time calculations in the interface clocks: UTC Clock Issues Fixed: - Remove incorrect timezone offset addition that was causing wrong UTC display - Use proper getUTCHours() and getUTCMinutes() methods directly on current time - Ensure UTC clock shows actual UTC time for aviation coordination Last Update Clock Issues Fixed: - Stop using UTC methods for local "last update" time display - Use getHours() and getMinutes() for proper local time representation - Last update clock now shows meaningful local time when data was received Technical Changes: - Add useUTC parameter to updateClock() method for proper time zone handling - Simplify time calculations by using appropriate Date methods - Add clear comments explaining clock behavior and timezone usage Expected Behavior: - UTC clock displays current UTC time (aviation standard) - Last update clock displays local time of most recent data update 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- assets/static/js/modules/ui-manager.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/assets/static/js/modules/ui-manager.js b/assets/static/js/modules/ui-manager.js index d72c8e7..8db8301 100644 --- a/assets/static/js/modules/ui-manager.js +++ b/assets/static/js/modules/ui-manager.js @@ -361,15 +361,15 @@ export class UIManager { updateClocks() { const now = new Date(); - const utcNow = new Date(now.getTime() + (now.getTimezoneOffset() * 60000)); - this.updateClock('utc', utcNow); - this.updateClock('update', this.lastUpdateTime); + this.updateClock('utc', now, true); // UTC clock - use UTC methods + this.updateClock('update', this.lastUpdateTime, false); // Last update clock - use local methods } - updateClock(prefix, time) { - const hours = time.getUTCHours(); - const minutes = time.getUTCMinutes(); + updateClock(prefix, time, useUTC = false) { + // Use appropriate time methods based on whether we want UTC or local time + const hours = useUTC ? time.getUTCHours() : time.getHours(); + const minutes = useUTC ? time.getUTCMinutes() : time.getMinutes(); const hourAngle = (hours % 12) * 30 + minutes * 0.5; const minuteAngle = minutes * 6;