From 811952fa01763463e91660ee08fa01089de71a10 Mon Sep 17 00:00:00 2001 From: jack1142 <6032823+jack1142@users.noreply.github.com> Date: Thu, 24 Jun 2021 08:37:53 +0200 Subject: [PATCH 1/4] Use new Discord timestamps --- githubcards/formatters.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/githubcards/formatters.py b/githubcards/formatters.py index c922559..7b4b7b1 100644 --- a/githubcards/formatters.py +++ b/githubcards/formatters.py @@ -73,7 +73,7 @@ def format_issue(issue_data: IssueData) -> discord.Embed: else: embed.description = issue_data.body_text embed.colour = getattr(IssueStateColour, issue_data.state) - formatted_datetime = issue_data.created_at.strftime('%d %b %Y, %H:%M') + formatted_datetime = f"" embed.set_footer(text=f"{issue_data.name_with_owner} • Created on {formatted_datetime}") if issue_data.labels: embed.add_field( From f287237b7c05e2c7752735d05df1f6d1cb530518 Mon Sep 17 00:00:00 2001 From: jack1142 <6032823+jack1142@users.noreply.github.com> Date: Thu, 24 Jun 2021 08:40:03 +0200 Subject: [PATCH 2/4] Cast to int --- githubcards/formatters.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/githubcards/formatters.py b/githubcards/formatters.py index 7b4b7b1..c2aee41 100644 --- a/githubcards/formatters.py +++ b/githubcards/formatters.py @@ -73,7 +73,7 @@ def format_issue(issue_data: IssueData) -> discord.Embed: else: embed.description = issue_data.body_text embed.colour = getattr(IssueStateColour, issue_data.state) - formatted_datetime = f"" + formatted_datetime = f"" embed.set_footer(text=f"{issue_data.name_with_owner} • Created on {formatted_datetime}") if issue_data.labels: embed.add_field( From 1a93af832cf23806bc9e3a06d736e7ceefc1959f Mon Sep 17 00:00:00 2001 From: jack1142 <6032823+jack1142@users.noreply.github.com> Date: Thu, 24 Jun 2021 08:50:12 +0200 Subject: [PATCH 3/4] sadly this doesn't render in footer --- githubcards/formatters.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/githubcards/formatters.py b/githubcards/formatters.py index c2aee41..fbc66a2 100644 --- a/githubcards/formatters.py +++ b/githubcards/formatters.py @@ -73,8 +73,6 @@ def format_issue(issue_data: IssueData) -> discord.Embed: else: embed.description = issue_data.body_text embed.colour = getattr(IssueStateColour, issue_data.state) - formatted_datetime = f"" - embed.set_footer(text=f"{issue_data.name_with_owner} • Created on {formatted_datetime}") if issue_data.labels: embed.add_field( name=f"Labels [{len(issue_data.labels)}]", @@ -86,7 +84,13 @@ def format_issue(issue_data: IssueData) -> discord.Embed: mergable_state = "Drafted" embed.add_field(name="Merge Status", value=mergable_state) if issue_data.milestone: - embed.add_field(name="Milestone", value=issue_data.milestone) + embed.add_field(name="Milestone", value=issue_data.milestone) + formatted_datetime = f"" + embed.add_field( + name="\u200b", + value=f"{issue_data.name_with_owner} • Created on {formatted_datetime}", + inline=False, + ) return embed @staticmethod From da76f967d53b3c52517bb63d491df5453e0f6f72 Mon Sep 17 00:00:00 2001 From: jack1142 <6032823+jack1142@users.noreply.github.com> Date: Thu, 24 Jun 2021 09:08:57 +0200 Subject: [PATCH 4/4] Switch to aware datetime object --- githubcards/formatters.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/githubcards/formatters.py b/githubcards/formatters.py index fbc66a2..6a93a7f 100644 --- a/githubcards/formatters.py +++ b/githubcards/formatters.py @@ -48,7 +48,7 @@ def format_issue_class(issue: dict) -> IssueData: mergeable_state=mergeable_state, milestone=milestone_title, labels=labels, - created_at=datetime.strptime(issue['createdAt'], '%Y-%m-%dT%H:%M:%SZ') + created_at=datetime.strptime(issue['createdAt'], '%Y-%m-%dT%H:%M:%S%z') ) return data