Date format for custom field does not respect values in configuration.py #7309

Closed
opened 2025-12-29 20:21:37 +01:00 by adam · 1 comment
Owner

Originally created by @ghost on GitHub (Dec 1, 2022).

Originally assigned to: @arthanson on GitHub.

NetBox version

v.3.3.8

Python version

3.8

Steps to Reproduce

I'm not sure if this is a bug or my own ignorance on where this field gets its formatting.

I have created a custom field with type 'date'.
In the netbox configuration.py I have adjusted the date/time formatting for short date format to m-d-Y.
When populating a date in the custom field, the short date format is still Y-m-d.

Date/time formatting.

DATE_FORMAT = 'N j, Y' # Dec 31, 2022
SHORT_DATE_FORMAT = 'm-d-Y' # 12-31-2022
TIME_FORMAT = 'g:i a' # 4:06 p.m.
SHORT_TIME_FORMAT = 'g:i:s a' # 4:06:32 p.m.
DATETIME_FORMAT = 'N j, Y g:i a' # Dec 31, 2022 4:06 p.m.
SHORT_DATETIME_FORMAT = 'm-d-Y g:i a' # 12-31-2022 4:06 p.m.

Original date/time format

#DATE_FORMAT = 'N j, Y' # Dec 31, 2022
#SHORT_DATE_FORMAT = 'Y-m-d' # 2022-12-31
#TIME_FORMAT = 'g:i a' # 4:06 p.m.
#SHORT_TIME_FORMAT = 'H:i:s' # 16:06:02
#DATETIME_FORMAT = 'N j, Y g:i a' # Dec 31, 2022 4:06 p.m.
#SHORT_DATETIME_FORMAT = 'Y-m-d H:i' # 2022-12-31 16:06

Expected Behavior

Expected behavior after changing
SHORT_DATE_FORMAT = 'Y-m-d' # 2022-12-31
to
SHORT_DATE_FORMAT = 'm-d-Y' # 12-31-2022

would be that the 'date' in the custom field would be displayed as m-d-Y.

Observed Behavior

Date displayed in the custom field is still Y-m-d.
1
2
3

Originally created by @ghost on GitHub (Dec 1, 2022). Originally assigned to: @arthanson on GitHub. ### NetBox version v.3.3.8 ### Python version 3.8 ### Steps to Reproduce I'm not sure if this is a bug or my own ignorance on where this field gets its formatting. I have created a custom field with type 'date'. In the netbox configuration.py I have adjusted the date/time formatting for short date format to m-d-Y. When populating a date in the custom field, the short date format is still Y-m-d. > # Date/time formatting. DATE_FORMAT = 'N j, Y' # Dec 31, 2022 SHORT_DATE_FORMAT = 'm-d-Y' # 12-31-2022 TIME_FORMAT = 'g:i a' # 4:06 p.m. SHORT_TIME_FORMAT = 'g:i:s a' # 4:06:32 p.m. DATETIME_FORMAT = 'N j, Y g:i a' # Dec 31, 2022 4:06 p.m. SHORT_DATETIME_FORMAT = 'm-d-Y g:i a' # 12-31-2022 4:06 p.m. # Original date/time format #DATE_FORMAT = 'N j, Y' # Dec 31, 2022 #SHORT_DATE_FORMAT = 'Y-m-d' # 2022-12-31 #TIME_FORMAT = 'g:i a' # 4:06 p.m. #SHORT_TIME_FORMAT = 'H:i:s' # 16:06:02 #DATETIME_FORMAT = 'N j, Y g:i a' # Dec 31, 2022 4:06 p.m. #SHORT_DATETIME_FORMAT = 'Y-m-d H:i' # 2022-12-31 16:06 ### Expected Behavior Expected behavior after changing `SHORT_DATE_FORMAT = 'Y-m-d' # 2022-12-31` to `SHORT_DATE_FORMAT = 'm-d-Y' # 12-31-2022` would be that the 'date' in the custom field would be displayed as m-d-Y. ### Observed Behavior Date displayed in the custom field is still Y-m-d. ![1](https://user-images.githubusercontent.com/119611316/205158637-7ee3abc1-1ef4-4138-8435-2d0e451210cd.png) ![2](https://user-images.githubusercontent.com/119611316/205158650-cb66ea50-e983-464e-b7ab-9632215a7781.png) ![3](https://user-images.githubusercontent.com/119611316/205158733-7af454dc-d1e5-4575-ba7a-5fca56179cdd.png)
adam added the type: bugstatus: accepted labels 2025-12-29 20:21:37 +01:00
adam closed this issue 2025-12-29 20:21:37 +01:00
Author
Owner

@jeremystretch commented on GitHub (Dec 1, 2022):

Looks like the table column is getting the native date object as expected, however it's not being displayed according to the configured format.

@jeremystretch commented on GitHub (Dec 1, 2022): Looks like the table column is getting the native `date` object as expected, however it's not being displayed according to the configured format.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#7309