Query MongoDB timestamps using normalized ISO string bounds

This commit is contained in:
Andras Schmelczer 2026-10-27 19:56:34 +00:00
commit ebb3a1fb65

View file

@ -0,0 +1,8 @@
from datetime import datetime, timezone
def normalise_datetime(value: datetime) -> datetime:
"""Interpret naive timestamps as UTC and normalize aware timestamps to UTC."""
return (
value.astimezone(timezone.utc).replace(tzinfo=None) if value.tzinfo else value
)