CubicWebJsonEncoder incorrectly serialize datetimes with timezones
When calling cubicweb.utils.json_dumps on a date with timezone I would expect to have the timezone serialized in the output string but the timezone is omitted. This will be blocking for application which use the rqlcontroller (through cwclientlib or cwclientlibjs) and rely on datetime with timezones.
import psycopg2.tz import datetime dt = datetime.datetime(2020, 6, 9, 16, 8, 48, 945851, tzinfo=psycopg2.tz.FixedOffsetTimezone(offset=4, name=None)) str(dt) # '2020-06-09 16:08:48.945851+00:04' json_dumps(dt) # '"2020/06/09 16:08:48"'
We could add a rule to handle datetime with timezones
Maybe we should start by migrating to ISO 8601 to avoid building applications on the current serialization and having to migrate all of them later.