Skip to content

Commit

Permalink
Fix: Add UTC timezone info to message.timestamp. (#4129)
Browse files Browse the repository at this point in the history
  • Loading branch information
dhlidongming authored Oct 14, 2024
1 parent 376e4cf commit e2e3369
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ def from_message(cls, message: "Message", flow_id: str | UUID | None = None):
message.files = image_paths

if isinstance(message.timestamp, str):
timestamp = datetime.fromisoformat(message.timestamp)
# The message.timestamp is created using strftime("%Y-%m-%dT%H:%M:%S").
# This format is not fully ISO 8601 compliant because it lacks timezone information.
# Aadd timezone info (UTC) back to the timestamp here.
timestamp = datetime.fromisoformat(message.timestamp).replace(tzinfo=timezone.utc)
else:
timestamp = message.timestamp
if not flow_id and message.flow_id:
Expand Down

0 comments on commit e2e3369

Please sign in to comment.