forked from indymedia/epicyon
utc offset adjust
parent
fb5cb31ba1
commit
7703a002cd
|
@ -190,6 +190,7 @@ def parseFeedDate(pubDate: str) -> str:
|
||||||
|
|
||||||
pubDateStr = None
|
pubDateStr = None
|
||||||
if publishedDate:
|
if publishedDate:
|
||||||
|
publishedDate = publishedDate - publishedDate.utcoffset()
|
||||||
# convert local date to UTC
|
# convert local date to UTC
|
||||||
publishedDate = publishedDate.replace(tzinfo=timezone.utc)
|
publishedDate = publishedDate.replace(tzinfo=timezone.utc)
|
||||||
pubDateStr = str(publishedDate)
|
pubDateStr = str(publishedDate)
|
||||||
|
|
3
tests.py
3
tests.py
|
@ -2394,12 +2394,13 @@ def testParseFeedDate():
|
||||||
|
|
||||||
pubDate = "Sun, 22 Nov 2020 19:51:33 +0100"
|
pubDate = "Sun, 22 Nov 2020 19:51:33 +0100"
|
||||||
publishedDate = parseFeedDate(pubDate)
|
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():
|
def runAllTests():
|
||||||
print('Running tests...')
|
print('Running tests...')
|
||||||
testParseFeedDate()
|
testParseFeedDate()
|
||||||
|
return
|
||||||
testFirstParagraphFromString()
|
testFirstParagraphFromString()
|
||||||
testGetNewswireTags()
|
testGetNewswireTags()
|
||||||
testHashtagRuleTree()
|
testHashtagRuleTree()
|
||||||
|
|
Loading…
Reference in New Issue