Skip to content

Commit f331f10

Browse files
committed
Do not use annotated_date on custom date fields to avoid date parsing
@jeremystretch: > It'd be better to have the custom field return a date object than to > accommodate string values in the template filter. Let's just omit custom > field dates for now to keep this from getting any more complex.
1 parent 74f1b51 commit f331f10

File tree

2 files changed

+0
-6
lines changed

2 files changed

+0
-6
lines changed

netbox/templates/inc/custom_fields_panel.html

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
<a href="{{ value }}">{{ value|truncatechars:70 }}</a>
1919
{% elif field.type == 'multiselect' and value %}
2020
{{ value|join:", " }}
21-
{% elif field.type == 'date' and value %}
22-
{{ value|annotated_date }}
2321
{% elif value is not None %}
2422
{{ value }}
2523
{% elif field.required %}

netbox/utilities/templatetags/helpers.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,6 @@ def annotated_date(date_value):
162162
if not date_value:
163163
return ''
164164

165-
# ../../templates/inc/custom_fields_panel.html passes a string.
166-
if type(date_value) == str:
167-
date_value = datetime.datetime.strptime(date_value, "%Y-%m-%d").date()
168-
169165
if type(date_value) == datetime.date:
170166
long_ts = date(date_value, 'DATE_FORMAT')
171167
short_ts = date(date_value, 'SHORT_DATE_FORMAT')

0 commit comments

Comments
 (0)