From 4e25d4a68ece514906a235929df085c7416d5093 Mon Sep 17 00:00:00 2001 From: michael Date: Tue, 21 Oct 2025 07:56:57 -0500 Subject: [PATCH] fixed date formatting in the JSON --- register_agents.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/register_agents.py b/register_agents.py index 972e3aa..2b1f8c2 100755 --- a/register_agents.py +++ b/register_agents.py @@ -45,6 +45,7 @@ def parse_iso(value: Any) -> Optional[str]: Best-effort: return ISO8601 string or None. - If value is already a string, return it (assuming it's already ISO8601). - If value looks like 'ISODate(\"...\")', extract the inner string. + - If value is Extended JSON format { "$date": "..." }, extract the date string. - Otherwise, return None. """ if value is None: @@ -53,6 +54,11 @@ def parse_iso(value: Any) -> Optional[str]: # Handle Mongo shell export style: ISODate('2025-07-09T06:33:12.682Z') m = re.match(r"^ISODate\(['\"]?([^'\"]+)['\"]?\)$", value.strip()) return m.group(1) if m else value + # Handle Extended JSON format: { "$date": "2025-07-09T06:33:12.682Z" } + if isinstance(value, dict) and "$date" in value: + date_val = value["$date"] + if isinstance(date_val, str): + return date_val # Could try to parse datetime objects here if needed; for now, prefer string passthrough return None