Skip to content

Commit

Permalink
Don't use datetime.utcnow(). (#440)
Browse files Browse the repository at this point in the history
* Don't use `datetime.utcnow()` (deprecated).

* Use timezone.utc for compatibility with Py<3.11
  • Loading branch information
smurfix authored Oct 19, 2024
1 parent fbd0197 commit 3fa71cd
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion caldav/objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -2999,7 +2999,7 @@ def complete(
* safe - see doc for _complete_recurring_safe for details
"""
if not completion_timestamp:
completion_timestamp = datetime.utcnow().astimezone(timezone.utc)
completion_timestamp = datetime.now(timezone.utc)

if "RRULE" in self.icalendar_component and handle_rrule:
return getattr(self, "_complete_recurring_%s" % rrule_mode)(
Expand Down
2 changes: 1 addition & 1 deletion tests/test_caldav.py
Original file line number Diff line number Diff line change
Expand Up @@ -2288,7 +2288,7 @@ def testCreateOverwriteDeleteEvent(self):
if not self.check_compatibility_flag(
"no_todo"
) and not self.check_compatibility_flag("no_todo_on_standard_calendar"):
t1.delete
t1.delete()

if self.check_compatibility_flag("non_existing_raises_other"):
expected_error = error.DAVError
Expand Down

0 comments on commit 3fa71cd

Please sign in to comment.