mirror of
https://github.com/inventree/InvenTree.git
synced 2026-11-21 07:25:31 +00:00
Check for empty string when rendering dates
This commit is contained in:
1 parent
d02fc61a8f
commit
b720c2e431
1 file changed
+7
@@ -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)
|
||||
|
||||
|
||||
Reference in new issue
Block a user