Skip to content

Commit

Permalink
Fix #87: Add sep=' ', timespec='seconds' arguments to isoformat calls…
Browse files Browse the repository at this point in the history
… in encoder.py
  • Loading branch information
yaph committed Sep 21, 2021
1 parent 549c6b7 commit 9647f58
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions logya/encoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
class JSONEncoder(json.JSONEncoder):
def default(self, obj):
if isinstance(obj, datetime.datetime):
return obj.isoformat()
return obj.isoformat(sep=' ', timespec='seconds')
elif isinstance(obj, datetime.date):
return obj.isoformat()
return obj.isoformat(sep=' ', timespec='seconds')
elif isinstance(obj, datetime.timedelta):
return (datetime.datetime.min + obj).time().isoformat()
return (datetime.datetime.min + obj).time().isoformat(sep=' ', timespec='seconds')

return json.JSONEncoder.default(self, obj)

0 comments on commit 9647f58

Please sign in to comment.