From 74d21f011c89398fc6f2b976a764ff86e3f4e61c Mon Sep 17 00:00:00 2001 From: Peter Bieringer Date: Fri, 22 Aug 2025 07:49:09 +0200 Subject: [PATCH] enrich for optional tzinfo --- radicale/item/filter.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/radicale/item/filter.py b/radicale/item/filter.py index b846023a..ef43dbcc 100644 --- a/radicale/item/filter.py +++ b/radicale/item/filter.py @@ -47,7 +47,7 @@ else: TRIGGER = datetime | None -def date_to_datetime(d: date) -> datetime: +def date_to_datetime(d: date, tzinfo=vobject.icalendar.utc) -> datetime: """Transform any date to a UTC datetime. If ``d`` is a datetime without timezone, return as UTC datetime. If ``d`` @@ -58,7 +58,7 @@ def date_to_datetime(d: date) -> datetime: d = datetime.combine(d, datetime.min.time()) if not d.tzinfo: # NOTE: using vobject's UTC as it wasn't playing well with datetime's. - d = d.replace(tzinfo=vobject.icalendar.utc) + d = d.replace(tzinfo=tzinfo) return d