Skip to content

Commit

Permalink
Replace ZoneInfo with datetime.timezone
Browse files Browse the repository at this point in the history
Signed-off-by: even-wei <[email protected]>
  • Loading branch information
even-wei committed Dec 25, 2024
1 parent 4735c96 commit 43ee720
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions recce/event/collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from contextlib import contextmanager
from datetime import datetime
from json import JSONDecodeError
from zoneinfo import ZoneInfo
from datetime import timezone

import portalocker
import requests
Expand Down Expand Up @@ -89,8 +89,8 @@ def log_event(self, event_prop, event_type, event_triggered_at: datetime = None,
if event_triggered_at is None:
created_at = datetime.now()
else:
# Convert to GMT timezone
created_at = event_triggered_at.astimezone(ZoneInfo("GMT"))
# Convert to UTC timezone
created_at = event_triggered_at.astimezone(timezone.utc)

Check warning on line 93 in recce/event/collector.py

View check run for this annotation

Codecov / codecov/patch

recce/event/collector.py#L93

Added line #L93 was not covered by tests
python_version = f'{sys.version_info.major}.{sys.version_info.minor}'

# when the recce is running in automation use cases
Expand Down

0 comments on commit 43ee720

Please sign in to comment.