mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
fix year 0 is out of range error
This commit is contained in:
parent
4672aaffb6
commit
a0ab7dcf62
1 changed files with 5 additions and 1 deletions
|
|
@ -111,7 +111,11 @@ def convert_string_to_datetime(val):
|
|||
if val is None:
|
||||
return None
|
||||
try:
|
||||
return datetime.strptime(val, DATE_FORMAT)
|
||||
date = datetime.strptime(val, DATE_FORMAT)
|
||||
if date.year <= 1:
|
||||
# avoid year 0 is out of range error
|
||||
return None
|
||||
return date
|
||||
except Exception as err:
|
||||
print('Convert string to datetime ERROR:', err)
|
||||
return None
|
||||
|
|
|
|||
Loading…
Reference in a new issue