mirror of
https://github.com/agent0ai/agent-zero.git
synced 2026-05-23 12:44:31 +00:00
Add user-configurable timezone and 12/24-hour preferences, then wire them through settings, runtime snapshots, scheduler payloads, wait handling, notifications, backups, memory, plugin metadata, and frontend formatters. Keep UTC as the boundary for absolute instants while serializing user-facing dates in the configured or browser-resolved timezone. Preserve scheduler wall-clock inputs in the selected timezone, propagate TZ into desktop/runtime process environments, and restart active desktop sessions when the runtime timezone changes. Cover the risky paths with timezone regression tests for settings normalization, auto and fixed timezone resolution, scheduler round-trips, memory timestamp conversion, and desktop timezone sync.
18 lines
649 B
Python
18 lines
649 B
Python
from helpers.api import ApiHandler, Request, Response
|
|
|
|
from helpers import settings
|
|
|
|
from typing import Any
|
|
|
|
|
|
class SetSettings(ApiHandler):
|
|
async def process(self, input: dict[Any, Any], request: Request) -> dict[Any, Any] | Response:
|
|
frontend = input.get("settings", input)
|
|
browser_timezone = input.get("browser_timezone")
|
|
backend = settings.convert_in(settings.Settings(**frontend))
|
|
backend = settings.set_settings(
|
|
backend,
|
|
browser_timezone=browser_timezone if isinstance(browser_timezone, str) else None,
|
|
)
|
|
out = settings.convert_out(backend)
|
|
return dict(out)
|