Skip to content

Commit 0e35d31

Browse files
authored
1 parent a56bb42 commit 0e35d31

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

convert_json.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,16 @@ def rss_item(title: str | None = None,
4444
item.append(ET.Element("pubDate"))
4545

4646
# Make sure months are processed correctly when there's some inconsistency
47-
# https://docs.python.org/3/library/datetime.html#format-codes
47+
# https://docs.python.org/3/library/datetime.html#format-codes
48+
# 09:00:00 EST is set as default for simplicity
4849
if pubDate.split(' ')[0] in calendar.month_name:
49-
fmt_date = datetime.strptime(pubDate, "%B %d, %Y").strftime("%d %b %Y")
50+
fmt_date = (datetime
51+
.strptime(pubDate, "%B %d, %Y 09:00:00 EST")
52+
.strftime("%d %b %Y"))
5053
elif pubDate.split(' ')[0] in calendar.month_abbr:
51-
fmt_date = datetime.strptime(pubDate, "%b %d, %Y").strftime("%d %b %Y")
54+
fmt_date = (datetime
55+
.strptime(pubDate, "%b %d, %Y 09:00:00 EST")
56+
.strftime("%d %b %Y"))
5257
else:
5358
fmt_date = '01 January 1970' # Just default to UNIX start
5459
item[-1].text = fmt_date

0 commit comments

Comments
 (0)