Skip to content

Commit 0854967

Browse files
authored
Update utils.py: make datetime object UTC timezone aware. (#115)
follow-up: pyrogram/pyrogram#966
1 parent 48d4230 commit 0854967

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pyrogram/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ def zero_datetime() -> datetime:
454454

455455

456456
def timestamp_to_datetime(ts: Optional[int]) -> Optional[datetime]:
457-
return datetime.fromtimestamp(ts) if ts else None
457+
return datetime.fromtimestamp(ts).replace(tzinfo=timezone.utc) if ts else None
458458

459459

460460
def datetime_to_timestamp(dt: Optional[datetime]) -> Optional[int]:

0 commit comments

Comments
 (0)