diff --git a/care/facility/templatetags/filters.py b/care/facility/templatetags/filters.py index e3e4910300..9a8bc576fa 100644 --- a/care/facility/templatetags/filters.py +++ b/care/facility/templatetags/filters.py @@ -27,4 +27,7 @@ def field_name_to_label(value): @register.filter(expects_localtime=True) def parse_datetime(value): - return datetime.strptime(value, "%Y-%m-%dT%H:%M") + try: + return datetime.strptime(value, "%Y-%m-%dT%H:%M") + except ValueError: + return None