From b720c2e4318a2a70d71e8ad19613b075c4be321d Mon Sep 17 00:00:00 2001 From: Oliver Date: Thu, 24 Mar 2022 11:49:34 +1100 Subject: [PATCH] Check for empty string when rendering dates --- InvenTree/part/templatetags/inventree_extras.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/InvenTree/part/templatetags/inventree_extras.py b/InvenTree/part/templatetags/inventree_extras.py index 3deab1ecd1..dd20d49e39 100644 --- a/InvenTree/part/templatetags/inventree_extras.py +++ b/InvenTree/part/templatetags/inventree_extras.py @@ -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)