forked from indymedia/epicyon
Handle dates with offset
parent
8fd41920f9
commit
4fdecc4f30
|
@ -339,8 +339,13 @@ def getRSSfromDict(baseDir: str, newswire: {},
|
||||||
None, domainFull,
|
None, domainFull,
|
||||||
'Newswire', translate)
|
'Newswire', translate)
|
||||||
for published, fields in newswire.items():
|
for published, fields in newswire.items():
|
||||||
published = published.replace('+00:00', 'Z').strip()
|
if '+00:00' in published:
|
||||||
published = published.replace(' ', 'T')
|
published = published.replace('+00:00', 'Z').strip()
|
||||||
|
published = published.replace(' ', 'T')
|
||||||
|
else:
|
||||||
|
publishedWithOffset = \
|
||||||
|
datetime.datetime.strptime(published, "%Y-%m-%d %H:%M:%S%z")
|
||||||
|
published = publishedWithOffset.strftime("%Y-%m-%dT%H:%M:%SZ")
|
||||||
try:
|
try:
|
||||||
pubDate = datetime.strptime(published, "%Y-%m-%dT%H:%M:%SZ")
|
pubDate = datetime.strptime(published, "%Y-%m-%dT%H:%M:%SZ")
|
||||||
except BaseException:
|
except BaseException:
|
||||||
|
|
Loading…
Reference in New Issue