Skip to content

Commit fbbf2c1

Browse files
authored
fix: parse of month in publication date
1 parent 3cd9804 commit fbbf2c1

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

convert_json.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ 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
48-
if pubDate in calendar.month_name:
47+
# https://docs.python.org/3/library/datetime.html#format-codes
48+
if pubDate.split(' ')[0] in calendar.month_name:
4949
fmt_date = datetime.strptime(pubDate, "%B %d, %Y").strftime("%d %b %Y")
50-
elif pubDate in calendar.month_abbr:
50+
elif pubDate.split(' ')[0] in calendar.month_abbr:
5151
fmt_date = datetime.strptime(pubDate, "%b %d, %Y").strftime("%d %b %Y")
5252
else:
5353
fmt_date = '01 January 1970' # Just default to UNIX start

0 commit comments

Comments
 (0)