mirror of
https://github.com/pyrogram/pyrogram
synced 2025-09-01 14:55:12 +00:00
Make timestamp_to_datetime timezone aware (#966)
* timezone aware object * Update utils.py Co-authored-by: Dan <14043624+delivrance@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
7bedf30d30
commit
b309caccd7
@@ -350,7 +350,7 @@ def zero_datetime() -> datetime:
|
|||||||
|
|
||||||
|
|
||||||
def timestamp_to_datetime(ts: Optional[int]) -> Optional[datetime]:
|
def timestamp_to_datetime(ts: Optional[int]) -> Optional[datetime]:
|
||||||
return datetime.fromtimestamp(ts) if ts else None
|
return datetime.fromtimestamp(ts, timezone.utc) if ts else None
|
||||||
|
|
||||||
|
|
||||||
def datetime_to_timestamp(dt: Optional[datetime]) -> Optional[int]:
|
def datetime_to_timestamp(dt: Optional[datetime]) -> Optional[int]:
|
||||||
|
Reference in New Issue
Block a user