This commit is contained in:
Peter Howell 2025-08-29 23:32:03 +00:00
parent e5fa6f0b76
commit 6030dc04f9
1 changed files with 13 additions and 2 deletions

View File

@ -822,6 +822,17 @@ def insert_usefulinfo_record(parsed):
except Exception as ex_dt:
print("[usefulinfo][event-parse] bad dt:", dt_str, "error:", str(ex_dt))
# Normalize DT string for storage
normalized_dt = dt_str
try:
if parsed_ok:
if all_day:
normalized_dt = p.date().isoformat() # YYYY-MM-DD
else:
normalized_dt = p.strftime('%Y-%m-%dT%H:%M:%S') # ISO without TZ
except Exception as ex_norm:
print("[usefulinfo][event-dt-normalize-failed] dt_str=", dt_str, " error=", str(ex_norm))
def _mins(s):
if not s:
return 60
@ -853,7 +864,7 @@ def insert_usefulinfo_record(parsed):
VALUES (%s, %s, %s, %s, %s)
RETURNING id
""",
(summary_id, raw_dt, raw_len, raw_title, raw_desc)
(summary_id, normalized_dt, raw_len, raw_title, raw_desc)
)
else:
CUR.execute(
@ -862,7 +873,7 @@ def insert_usefulinfo_record(parsed):
VALUES (%s, %s, %s, %s)
RETURNING id
""",
(raw_dt, raw_len, raw_title, raw_desc)
(normalized_dt, raw_len, raw_title, raw_desc)
)
evrow = CUR.fetchone()
if evrow and evrow[0]: