You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
That's the correct behavior. The default JSONEncoder accepts times with any timezone as input, but always outputs UTC (GMT) in RFC 1123 format.
In the vast majority of cases, you should be working with UTC at boundaries and converting to local time only when displaying to users.
If you want to change the format that dates are serialized, including supporting other timezones, override app.json_encoder with your own flask.json.JSONEncoder subclass.
According to this Stack Overflow answer, ISO 8601 is the preferred standard over RFC 1123/822/2822. This link further defines the current best practice.
Issue
Jsonify always returns datetime objects as GMT timezone. Seems like this has been a problem in the past with these issues:
Environment
Testcode
Console output:
Jsonify output:
The text was updated successfully, but these errors were encountered: