Skip to content

Commit

Permalink
add timedelta encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
thomaxxl committed Dec 12, 2023
1 parent 714708a commit 56f3839
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion safrs/json_encoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ def default(self, obj, **kwargs):
if isinstance(obj, Included):
result = obj.encode()
return result
if isinstance(obj, datetime.timedelta):
return str(obj)
if isinstance(obj, SAFRSBase):
result = obj._s_jsonapi_encode()
return result
Expand Down Expand Up @@ -157,4 +159,4 @@ class SAFRSJSONEncoder(_SAFRSJSONEncoder, json.JSONEncoder):
"""
Common JSON encoding
"""
pass
pass

0 comments on commit 56f3839

Please sign in to comment.