forked from indymedia/epicyon
utc offset adjust
parent
fb5cb31ba1
commit
7703a002cd
|
@ -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)
|
||||
|
|
3
tests.py
3
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()
|
||||
|
|
Loading…
Reference in New Issue