Skip to content

Commit

Permalink
Merge pull request #937 from jimkring/patch-1
Browse files Browse the repository at this point in the history
Format timestamp platform independently for assistant message panels
  • Loading branch information
zzstoatzz authored Jun 28, 2024
2 parents facc740 + b517454 commit 7a1e4ad
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/marvin/beta/assistants/formatting.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,13 @@ def download_temp_file(file_id: str):


def format_timestamp(timestamp: int) -> str:
return datetime.fromtimestamp(timestamp).strftime("%l:%M:%S %p")
"""Outputs timestamp as a string in 12 hour format. Hours are left-padded with space instead of zero."""
return (
datetime.datetime.fromtimestamp(timestamp)
.strftime("%I:%M:%S %p")
.lstrip("0")
.rjust(11)
)


def create_panel(content: Any, title: str, timestamp: int, color: str):
Expand Down

0 comments on commit 7a1e4ad

Please sign in to comment.