Access datetime.datetime and .time directly in caldav (#93688)

pull/93971/head
Ville Skyttä 2023-05-29 21:27:47 +03:00 committed by GitHub
parent a3ce1ac497
commit f5cba290ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 4 deletions

View File

@ -1,7 +1,7 @@
"""Support for WebDav Calendar."""
from __future__ import annotations
from datetime import date, datetime, timedelta
from datetime import date, datetime, time, timedelta
from functools import partial
import logging
import re
@ -321,9 +321,7 @@ class WebDavCalendarData:
"""Return a datetime."""
if isinstance(obj, datetime):
return WebDavCalendarData.to_local(obj)
return dt.dt.datetime.combine(obj, dt.dt.time.min).replace(
tzinfo=dt.DEFAULT_TIME_ZONE
)
return datetime.combine(obj, time.min).replace(tzinfo=dt.DEFAULT_TIME_ZONE)
@staticmethod
def to_local(obj: datetime | date) -> datetime | date: