mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-04-07 02:34:24 +03:00
Fixed TimeField not handling empty values
This commit is contained in:
parent
edd9c7de02
commit
a76c3ed051
|
@ -1204,6 +1204,8 @@ class TimeField(Field):
|
|||
)
|
||||
|
||||
if output_format.lower() == ISO_8601:
|
||||
if (isinstance(value, str)):
|
||||
value = datetime.datetime.strptime(value, '%H:%M:%S').time()
|
||||
return value.isoformat()
|
||||
return value.strftime(output_format)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user