More date parsing

main
Bob Mottram 2025-10-25 18:42:49 +01:00
parent 72aa1bd08f
commit 9a64794e72
2 changed files with 7 additions and 1 deletions

View File

@ -316,7 +316,8 @@ def parse_feed_date(pub_date: str, unique_string_identifier: str) -> str:
"%a, %d %b %Y %H:%M:%S HST",
"%a, %d %b %Y %H:%M:%S UT",
"%Y-%m-%dT%H:%M:%S%z",
"%Y-%m-%dT%H:%M:%S%Z")
"%Y-%m-%dT%H:%M:%S%Z",
"%a, %d %b %Y %H:%M:%S")
published_date = None
for date_format in formats:
if ',' in pub_date and ',' not in date_format:

View File

@ -5141,6 +5141,11 @@ def _test_parse_newswire_feed_date():
assert published_date != "2020-11-22 00:00:00+00:00"
assert "2020-11-22 00:" in published_date
pub_date = "Sun, 08 Jun 2025 00:50:05"
published_date = parse_feed_date(pub_date, unique_string_identifier)
assert published_date != "2025-06-08 00:50:05"
assert "2025-06-08 00:50:05+00:00" in published_date
def _test_valid_nick():
print('test_valid_nickname')