Don't strip microseconds in JSON output. by tomchristie · Pull Request #4256 · encode/django-rest-framework (original) (raw)
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Conversation4 Commits1 Checks0 Files changed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
[ Show hidden characters]({{ revealButtonHref }})
Current coverage is 91.23%
@@ master #4256 diff @@
Files 52 52
Lines 5778 5776 -2
Methods 0 0
Messages 0 0
Branches 0 0
Hits 5270 5270
- Misses 508 506 -2
Partials 0 0
Powered by Codecov. Last updated by 7bfa5a9...9164c3b
The JSON spec has no guidance on datetime formatting. https://tools.ietf.org/html/rfc7159
The current default is for DateTimeField to coerce to strings, so .ssssss
is our current behavior unless you explicitly return a datetime
, or unless you've set DATETIME_FORMAT
to None
in the settings.
This change ensures that we're consistent throughout. Users can still set DATETIME_FORMAT
if they want a different behavior.
But yes, very much wasn't sure on that when you re-raised. And there is the reading should be that JSON should be a subset of ECMA, but that seems pretty loose, stated as a design goal rather than a requirement. (and it's also not quite a subset)
xordoquy added a commit that referenced this pull request
Refs: #4256 delete not relevant documentation
carltongibson added a commit to carltongibson/django-rest-framework that referenced this pull request
carltongibson added a commit that referenced this pull request
Closes #4749.
This is the matching commit to the fix for datetime
in #4256