Skip to content

Commit fc838cf

Browse files
authored
Fix Message.date timezone conversion causing logical errors in time comparison (#193)
* Fix timestamp_to_datetime to correctly handle timezone conversion Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
1 parent 84c823b commit fc838cf

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
@@ -466,7 +466,7 @@ def zero_datetime() -> datetime:
466466

467467

468468
def timestamp_to_datetime(ts: Optional[int]) -> Optional[datetime]:
469-
return datetime.fromtimestamp(ts).replace(tzinfo=timezone.utc) if ts else None
469+
return datetime.fromtimestamp(ts, tz=timezone.utc) if ts else None
470470

471471

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

0 commit comments

Comments
 (0)