mirror of https://gitlab.com/bashrc2/epicyon
Handle exception on date format
parent
c79ca40cc5
commit
7d22d2ec25
8
utils.py
8
utils.py
|
@ -47,8 +47,12 @@ def validPostDate(published: str, maxAgeDays=7) -> bool:
|
|||
daysDiff = datetime.datetime.utcnow() - baselineTime
|
||||
nowDaysSinceEpoch = daysDiff.days
|
||||
|
||||
postTimeObject = \
|
||||
datetime.datetime.strptime(published, "%Y-%m-%dT%H:%M:%SZ")
|
||||
try:
|
||||
postTimeObject = \
|
||||
datetime.datetime.strptime(published, "%Y-%m-%dT%H:%M:%SZ")
|
||||
except BaseException:
|
||||
return False
|
||||
|
||||
daysDiff = postTimeObject - baselineTime
|
||||
postDaysSinceEpoch = daysDiff.days
|
||||
|
||||
|
|
Loading…
Reference in New Issue