diff --git a/rest_framework/utils/encoders.py b/rest_framework/utils/encoders.py index 8896e4f2c..33dbb1bb4 100644 --- a/rest_framework/utils/encoders.py +++ b/rest_framework/utils/encoders.py @@ -37,8 +37,6 @@ class JSONEncoder(json.JSONEncoder): if timezone and timezone.is_aware(obj): raise ValueError("JSON can't represent timezone-aware times.") representation = obj.isoformat() - if obj.microsecond: - representation = representation[:12] return representation elif isinstance(obj, datetime.timedelta): return six.text_type(total_seconds(obj)) diff --git a/tests/test_encoders.py b/tests/test_encoders.py index 8f8694c47..27136df87 100644 --- a/tests/test_encoders.py +++ b/tests/test_encoders.py @@ -44,7 +44,7 @@ class JSONEncoderTests(TestCase): Tests encoding a timezone """ current_time = datetime.now().time() - assert self.encoder.default(current_time) == current_time.isoformat()[:12] + assert self.encoder.default(current_time) == current_time.isoformat() def test_encode_time_tz(self): """