agent-zero icon indicating copy to clipboard operation
agent-zero copied to clipboard

feat: display container system time instead of browser time

Open TerminallyLazy opened this issue 2 months ago • 0 comments

Summary

Replace browser-based clock with backend-driven system time display to show the Linux container's time instead of the user's browser time.

Problem

  • UI clock displayed frontend (browser) time, not the system time of the container
  • Backend timezone was re-synced on every poll request based on browser timezone
  • Users connecting from different timezones would override the system timezone
  • This caused problems with the task scheduler and created inconsistent behavior

Solution

  • Backend (python/api/poll.py): Added system_time field to poll response with server's localized time formatted as ISO (minutes precision)
  • Timezone Persistence (python/helpers/localization.py): Modified initialization to only persist timezone to .env once, then respect the stored value
  • Frontend Component (webui/components/system-clock/): Created dedicated Alpine.js store and component to display backend time
  • Polling Logic (webui/index.js): Removed browser time updater, added one-time timezone sync flag, integrated system clock store updates
  • Locale Preservation: Parse server ISO timestamp and format using Intl.DateTimeFormat with timeZone: "UTC" to respect user locale (24h/12h, month names) while displaying container time

Changes

Backend

  • python/api/poll.py: Add system_time generation and one-time timezone sync logic
  • python/helpers/localization.py: Update __init__ to avoid persisting default timezone until explicitly set

Frontend (New)

  • webui/components/system-clock/system-clock.html: Clock component template
  • webui/components/system-clock/system-clock-store.js: Alpine store for time state and formatting

Frontend (Modified)

  • webui/components/chat/top-section/chat-top.html: Replace inline time div with x-component
  • webui/index.js: Import system clock store, remove updateUserTime(), update poll to sync timezone once
  • webui/index.css: Remove #time-date and #user-date styles (moved to component)

TerminallyLazy avatar Nov 18 '25 10:11 TerminallyLazy