mirror of
https://github.com/inventree/InvenTree.git
synced 2025-05-02 05:26:45 +00:00
Check for empty string when rendering dates
This commit is contained in:
parent
d02fc61a8f
commit
b720c2e431
@ -57,6 +57,13 @@ def render_date(context, date_object):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
if type(date_object) == str:
|
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
|
# If a string is passed, first convert it to a datetime
|
||||||
date_object = date.fromisoformat(date_object)
|
date_object = date.fromisoformat(date_object)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user