feat(aurora): subclassed jsonencoder to allow for custom behavior
All checks were successful
Actions / Build Documentation (MkDocs) (pull_request) Successful in 32s
Actions / Lint Code (Ruff & Pylint) (pull_request) Successful in 46s

This commit is contained in:
Seaswimmer 2024-05-04 14:18:19 -04:00
parent e5cdd3893f
commit 2da76eb51a
Signed by: cswimr
GPG key ID: 5D671B5D03D65A7F

View file

@ -68,3 +68,11 @@ class Moderation(BaseModel):
return cls(**case)
return None
class JSONEncoder(json.JSONEncoder):
def default(self, o):
if isinstance(o, datetime):
return o.timestamp()
if isinstance(o, timedelta):
return str(o)
return super().default(o)