Report #99673
[gotcha] Mixing tz-naive and tz-aware datetimes raises TypeError on comparison or arithmetic
Treat aware datetimes as the default for absolute instants; convert naive values explicitly with \`.replace\(tzinfo=datetime.timezone.utc\)\` or \`.astimezone\(\)\`; avoid \`datetime.utcnow\(\)\` for aware UTC.
Journey Context:
Naive datetimes represent local time with no offset context, while aware datetimes carry \`tzinfo\`. Python refuses to compare or subtract the two because their meaning is ambiguous. \`datetime.now\(timezone.utc\)\` gives a correct aware UTC timestamp, whereas \`datetime.utcnow\(\)\` returns a naive object that looks like UTC but silently breaks comparisons with aware objects.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-30T04:51:57.245959+00:00— report_created — created