Skip to content

Commit 55436dd

Browse files
author
Alejandro Casanovas
committed
remove utc conversion when querying events and inside Query class
1 parent e064cea commit 55436dd

File tree

2 files changed

+0
-10
lines changed

2 files changed

+0
-10
lines changed

O365/calendar.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1399,19 +1399,13 @@ def get_occurrences(self, start, end, *, limit=None, query=None, order_by=None,
13991399
if start.tzinfo is None:
14001400
# if it's a naive datetime, localize the datetime.
14011401
start = start.replace(tzinfo=self.protocol.timezone) # localize datetime into local tz
1402-
# TODO: convert to utc when quering?
1403-
if start.tzinfo != dt.timezone.utc:
1404-
start = start.astimezone(dt.timezone.utc) # transform local datetime to utc
14051402

14061403
if isinstance(end, dt.date):
14071404
# Convert an all-day date which only contains year/month/day into a datetime object
14081405
end = dt.datetime(end.year, end.month, end.day)
14091406
if end.tzinfo is None:
14101407
# if it's a naive datetime, localize the datetime.
14111408
end = end.replace(tzinfo=self.protocol.timezone) # localize datetime into local tz
1412-
# TODO: convert to utc when quering?
1413-
if end.tzinfo != dt.timezone.utc:
1414-
end = end.astimezone(dt.timezone.utc) # transform local datetime to utc
14151409

14161410
params[self._cc('startDateTime')] = start.isoformat()
14171411
params[self._cc('endDateTime')] = end.isoformat()

O365/utils/utils.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -970,10 +970,6 @@ def _parse_filter_word(self, word):
970970
if word.tzinfo is None:
971971
# if it's a naive datetime, localize the datetime.
972972
word = word.replace(tzinfo=self.protocol.timezone) # localize datetime into local tz
973-
# TODO: remove UTC CONVERSION: not affected when quering calendar events
974-
if word.tzinfo != dt.timezone.utc:
975-
word = word.astimezone(
976-
dt.timezone.utc) # transform local datetime to utc
977973
if '/' in self._attribute:
978974
# TODO: this is a fix for the case when the parameter
979975
# filtered is a string instead a dateTimeOffset

0 commit comments

Comments
 (0)