forked from indymedia/epicyon
Convert dates with offset
parent
fda4e294f8
commit
456b4202b1
|
@ -478,8 +478,13 @@ def convertRSStoActivityPub(baseDir: str, httpPrefix: str,
|
||||||
for dateStr, item in newswireReverse.items():
|
for dateStr, item in newswireReverse.items():
|
||||||
originalDateStr = dateStr
|
originalDateStr = dateStr
|
||||||
# convert the date to the format used by ActivityPub
|
# convert the date to the format used by ActivityPub
|
||||||
|
if '+00:00' in dateStr:
|
||||||
dateStr = dateStr.replace(' ', 'T')
|
dateStr = dateStr.replace(' ', 'T')
|
||||||
dateStr = dateStr.replace('+00:00', 'Z')
|
dateStr = dateStr.replace('+00:00', 'Z')
|
||||||
|
else:
|
||||||
|
dateStrWithOffset = \
|
||||||
|
datetime.datetime.strptime(dateStr, "%Y-%m-%d %H:%M:%S%z")
|
||||||
|
dateStr = dateStrWithOffset.strftime("%Y-%m-%dT%H:%M:%SZ")
|
||||||
|
|
||||||
statusNumber, published = getStatusNumber(dateStr)
|
statusNumber, published = getStatusNumber(dateStr)
|
||||||
newPostId = \
|
newPostId = \
|
||||||
|
|
|
@ -344,7 +344,7 @@ def getRSSfromDict(baseDir: str, newswire: {},
|
||||||
published = published.replace(' ', 'T')
|
published = published.replace(' ', 'T')
|
||||||
else:
|
else:
|
||||||
publishedWithOffset = \
|
publishedWithOffset = \
|
||||||
datetime.datetime.strptime(published, "%Y-%m-%d %H:%M:%S%z")
|
datetime.strptime(published, "%Y-%m-%d %H:%M:%S%z")
|
||||||
published = publishedWithOffset.strftime("%Y-%m-%dT%H:%M:%SZ")
|
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")
|
||||||
|
|
Loading…
Reference in New Issue