json: always use UTC datetime format (#6927)
This commit is contained in:
parent
3c6b72006f
commit
2ba78294e4
|
@ -388,6 +388,6 @@ def indent_xml(elem, level=0):
|
|||
class JSONEncoder(json.JSONEncoder):
|
||||
def default(self, obj):
|
||||
if isinstance(obj, time.struct_time):
|
||||
return qommon.strftime.strftime('%Y-%m-%dT%H:%M:%S', obj)
|
||||
return datetime.datetime.utcfromtimestamp(time.mktime(obj)).isoformat() + 'Z'
|
||||
# Let the base class default method raise the TypeError
|
||||
return json.JSONEncoder.default(self, obj)
|
||||
|
|
Loading…
Reference in New Issue