format of date_time custom fields through the REST API on GET are not compatible with POST #13925
Labels
severity: low
Does not significantly disrupt application functionality, or a workaround is available
status: needs owner
This issue is tentatively accepted pending a volunteer committed to its implementation
type: bug
A confirmed report of unexpected behavior in the application
NetBox version
v3.5.4
Python version
3.10
Steps to Reproduce
Expected Behavior
The input format of datetime should be compatible with the output format.
Observed Behavior
We receive this error:
Correct me if I'm wrong, but the values observed through the API are serialized with django rest_framework, which could explain why there's a different format between the rest api and inside the database. But when we do a post, the validation go through extras/models/customfields.py and use
datetime.fromisoformat()
(also for deserialisation).Starting python 3.11 fromisoformat() is compatible with the YYYY-mm-ddTHH:MM:SSZ format, but not former version (see changed in version 3.11 in the doc). But it's not always easy to upgrade python.
I patched my version with
dateutil.parser.parse()
instead ofdatetime.fromisoformat()
and it's working as expected. Should I make a PR?Thanks
The text was updated successfully, but these errors were encountered: