String Check, catch NoneType error

This commit is contained in:
Tom Weber 2021-02-24 07:19:37 -07:00
parent d06626c0d6
commit 1271f00278

View File

@ -23,12 +23,12 @@ def datetime_string_format(value):
"""
try:
new_value = date_filter(datetime.strptime(value, CUSTOMFIELD_DATETIME_FORMAT), settings.DATETIME_FORMAT)
except ValueError:
except (TypeError, ValueError):
try:
new_value = date_filter(datetime.strptime(value, CUSTOMFIELD_DATE_FORMAT), settings.DATE_FORMAT)
except ValueError:
except (TypeError, ValueError):
try:
new_value = date_filter(datetime.strptime(value, CUSTOMFIELD_TIME_FORMAT), settings.TIME_FORMAT)
except ValueError:
except (TypeError, ValueError):
new_value = value
return new_value