MCPcopy Index your code
hub / github.com/agent0ai/agent-zero / _normalize_timezone

Function _normalize_timezone

tools/scheduler.py:36–51  ·  view source on GitHub ↗
(value: Any)

Source from the content-addressed store, hash-verified

34
35
36def _normalize_timezone(value: Any) -> str | None:
37 if value is None:
38 return None
39 timezone_name = str(value).strip()
40 if not timezone_name:
41 return None
42 if timezone_name.lower() in LOCAL_TIMEZONE_ALIASES:
43 return Localization.get().get_timezone()
44 try:
45 pytz.timezone(timezone_name)
46 except pytz.exceptions.UnknownTimeZoneError as exc:
47 raise ValueError(
48 f"Invalid timezone: {timezone_name}. Use an IANA timezone name such as Europe/Rome, "
49 "or omit timezone to use the current user timezone."
50 ) from exc
51 return timezone_name
52
53
54def _schedule_timezone(kwargs: dict) -> str | None:

Callers 2

_schedule_timezoneFunction · 0.85

Calls 2

get_timezoneMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected