Date format check

main
Bob Mottram 2020-11-22 15:41:42 +00:00
parent c937cbdac8
commit 944fa554e7
1 changed files with 6 additions and 2 deletions

View File

@ -214,8 +214,12 @@ def htmlNewswire(baseDir: str, newswire: {}, nickname: str, moderator: bool,
item[0] = item[0].split('CDATA[')[1]
if ']' in item[0]:
item[0] = item[0].split(']')[0]
publishedDate = \
datetime.strptime(dateStr, "%Y-%m-%d %H:%M:%S%z")
try:
publishedDate = \
datetime.strptime(dateStr, "%Y-%m-%d %H:%M:%S%z")
except BaseException:
print('WARN: bad date format ' + dateStr)
continue
dateShown = publishedDate.strftime("%Y-%m-%d %H:%M")
dateStrLink = dateStr.replace('T', ' ')