From 7703a002cd25eae4622974f1e7434d3e33be412f Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 22 Nov 2020 20:18:10 +0000 Subject: [PATCH] utc offset adjust --- newswire.py | 1 + tests.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) 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()