1
0
forked from ScoDoc/ScoDoc

JSON: exporte dates au format ISO

This commit is contained in:
Emmanuel Viennet 2022-10-23 14:51:57 +02:00
parent caf88c5909
commit a92d2a6edf

View File

@ -119,7 +119,7 @@ def handle_invalid_usage(error):
# JSON ENCODING # JSON ENCODING
class ScoDocJSONEncoder(JSONEncoder): class ScoDocJSONEncoder(JSONEncoder):
def default(self, o): def default(self, o):
if isinstance(o, datetime.datetime): if isinstance(o, (datetime.datetime, datetime.date)):
return o.isoformat() return o.isoformat()
return super().default(o) return super().default(o)