fix: Correct UTC and Last Update clock display issues

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 <noreply@anthropic.com>
This commit is contained in:
Ole-Morten Duesund 2025-09-01 11:19:02 +02:00
commit 978d1c0859

View file

@ -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;