Skip to content

Commit

Permalink
Add UTC timezone for decoded naive timestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
decaz committed Dec 28, 2023
1 parent 8225acf commit e966a96
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions aio_pika/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ def decode_timestamp(value: Any) -> Optional[datetime]:

@decode_timestamp.register(datetime)
def decode_timestamp_datetime(value: datetime) -> datetime:
if value.tzinfo is None or value.tzinfo.utcoffset(value) is None:
value = value.replace(tzinfo=timezone.utc)
return value


Expand Down

0 comments on commit e966a96

Please sign in to comment.