From 343143e8e776bb87ce326f46fc38b9cf828099ff Mon Sep 17 00:00:00 2001 From: "Phyks (Lucas Verney)" Date: Thu, 2 Aug 2018 11:14:38 +0200 Subject: [PATCH] Ensure server always return proper ISO encoded dates with timezone --- server/jsonapi.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server/jsonapi.py b/server/jsonapi.py index 86c1a4b..f866fe6 100644 --- a/server/jsonapi.py +++ b/server/jsonapi.py @@ -3,6 +3,7 @@ """ Helpers to implement a JSON API with Bottle. """ +import arrow import datetime import json import re @@ -18,7 +19,7 @@ class DateAwareJSONEncoder(json.JSONEncoder): """ def default(self, o): # pylint: disable=locally-disabled,E0202 if isinstance(o, (datetime.date, datetime.datetime)): - return o.isoformat() + return arrow.get(o).isoformat() return json.JSONEncoder.default(self, o)