Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion slack_sdk/oauth/installation_store/internals.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from datetime import datetime
from datetime import datetime, timezone
from typing import Type, TypeVar, Union


Expand Down Expand Up @@ -28,6 +28,9 @@ def _timestamp_to_type(ts: Union[TimestampType, datetime, str], target_type: Typ
# see https://github.com/google/pytype/issues/1012

elif isinstance(ts, datetime):
if ts.tzinfo is None:
# naive datetime values (e.g., loaded from a database) are stored in UTC

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code is self explanatory 🙏 I don't think we need this comment

Once removed we should be good to merge 🚀

Suggested change
# naive datetime values (e.g., loaded from a database) are stored in UTC

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed in 9b07398, thanks!

ts = ts.replace(tzinfo=timezone.utc)
result = target_type(ts.timestamp())
elif isinstance(ts, str):
try:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def test_iso_format(self):
[
(1701209097, int, 1701209097),
(datetime(2023, 11, 28, 22, 9, 7, tzinfo=timezone.utc), int, 1701209347),
(datetime(2023, 11, 28, 22, 9, 7), int, 1701209347),
("1701209605", int, 1701209605),
("2023-11-28 22:11:19", int, 1701209479),
(1701209998.3429494, float, 1701209998.3429494),
Expand Down