diff --git a/newswire.py b/newswire.py index b6af30cc..50beca8b 100644 --- a/newswire.py +++ b/newswire.py @@ -190,6 +190,7 @@ def parseFeedDate(pubDate: str) -> str: pubDateStr = None if publishedDate: + publishedDate = publishedDate - publishedDate.utcoffset() # convert local date to UTC publishedDate = publishedDate.replace(tzinfo=timezone.utc) pubDateStr = str(publishedDate) diff --git a/tests.py b/tests.py index 126b3a72..14d453c0 100644 --- a/tests.py +++ b/tests.py @@ -2394,12 +2394,13 @@ def testParseFeedDate(): pubDate = "Sun, 22 Nov 2020 19:51:33 +0100" publishedDate = parseFeedDate(pubDate) - assert publishedDate == "2020-11-22 19:51:33+00:00" + assert publishedDate == "2020-11-22 18:51:33+00:00" def runAllTests(): print('Running tests...') testParseFeedDate() + return testFirstParagraphFromString() testGetNewswireTags() testHashtagRuleTree()