date format fix
This commit is contained in:
@@ -94,10 +94,20 @@ async def delete_timeline(timeline_id: str) -> str:
|
||||
|
||||
|
||||
@tool
|
||||
async def list_timelines_today() -> str:
|
||||
"""List all timeline events (milestones) whose date falls on today (UTC)."""
|
||||
now = datetime.now(tz=timezone.utc)
|
||||
start_ms = int(datetime(now.year, now.month, now.day, tzinfo=timezone.utc).timestamp() * 1000)
|
||||
async def list_timelines_today(user_timezone: str = "UTC") -> str:
|
||||
"""List all timeline events (milestones) whose date falls on today.
|
||||
|
||||
user_timezone: IANA timezone name (e.g. 'Europe/Rome', 'America/New_York').
|
||||
Always pass the user's timezone so 'today' is computed in their local time.
|
||||
"""
|
||||
try:
|
||||
from zoneinfo import ZoneInfo
|
||||
tz = ZoneInfo(user_timezone or "UTC")
|
||||
except Exception:
|
||||
tz = timezone.utc
|
||||
now_local = datetime.now(tz=tz)
|
||||
start_dt = datetime(now_local.year, now_local.month, now_local.day, tzinfo=tz)
|
||||
start_ms = int(start_dt.timestamp() * 1000)
|
||||
end_ms = start_ms + 86_400_000 - 1
|
||||
result = await execute_on_client(
|
||||
action="select",
|
||||
|
||||
Reference in New Issue
Block a user