Check for empty string when rendering dates

This commit is contained in:
Oliver 2022-03-24 11:49:34 +11:00
parent d02fc61a8f
commit b720c2e431

View File

@ -57,6 +57,13 @@ def render_date(context, date_object):
return None
if type(date_object) == str:
date_object = date_object.strip()
# Check for empty string
if len(date_object) == 0:
return None
# If a string is passed, first convert it to a datetime
date_object = date.fromisoformat(date_object)