refac
This commit is contained in:
1 parent
189c14fc4d
commit
9550731cc1
1 file changed
+4
-5
@@ -4056,6 +4056,9 @@ async def delete_automation(
|
|||||||
# =============================================================================
|
# =============================================================================
|
||||||
|
|
||||||
|
|
||||||
|
MAX_CALENDAR_RANGE_END_NS = 2**63 - 1
|
||||||
|
|
||||||
|
|
||||||
def _get_user_tz(user_dict: dict):
|
def _get_user_tz(user_dict: dict):
|
||||||
"""Get the user's timezone as a ZoneInfo, falling back to UTC."""
|
"""Get the user's timezone as a ZoneInfo, falling back to UTC."""
|
||||||
from zoneinfo import ZoneInfo
|
from zoneinfo import ZoneInfo
|
||||||
@@ -4155,11 +4158,7 @@ async def search_calendar_events(
|
|||||||
return JSONCodec.dumps({'error': f'Invalid start datetime: {e}'})
|
return JSONCodec.dumps({'error': f'Invalid start datetime: {e}'})
|
||||||
|
|
||||||
try:
|
try:
|
||||||
end_ns = (
|
end_ns = _dt_to_ns(end, tz) if end else MAX_CALENDAR_RANGE_END_NS
|
||||||
_dt_to_ns(end, tz)
|
|
||||||
if end
|
|
||||||
else int(time.time() * 1_000) * 1_000_000 + 365 * 86400 * 1_000_000_000_000
|
|
||||||
)
|
|
||||||
except (ValueError, TypeError) as e:
|
except (ValueError, TypeError) as e:
|
||||||
return JSONCodec.dumps({'error': f'Invalid end datetime: {e}'})
|
return JSONCodec.dumps({'error': f'Invalid end datetime: {e}'})
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user