mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-22 17:47:04 +03:00
Don't strip microseconds in JSON output. (#4256)
This commit is contained in:
parent
7bfa5a9141
commit
549210b50f
|
@ -28,8 +28,6 @@ class JSONEncoder(json.JSONEncoder):
|
||||||
return force_text(obj)
|
return force_text(obj)
|
||||||
elif isinstance(obj, datetime.datetime):
|
elif isinstance(obj, datetime.datetime):
|
||||||
representation = obj.isoformat()
|
representation = obj.isoformat()
|
||||||
if obj.microsecond:
|
|
||||||
representation = representation[:23] + representation[26:]
|
|
||||||
if representation.endswith('+00:00'):
|
if representation.endswith('+00:00'):
|
||||||
representation = representation[:-6] + 'Z'
|
representation = representation[:-6] + 'Z'
|
||||||
return representation
|
return representation
|
||||||
|
|
Loading…
Reference in New Issue
Block a user