We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
flask.json.JSONEncoder() encodes aware datetime objects in non-UTC timezone incorrectly using local time tuple with GMT.
flask.json.JSONEncoder()
The following code segment should print "Sun, 01 Jan 2017 20:34:56 GMT" (12:34:56 PST8PDT is 20:34:56 GMT):
"Sun, 01 Jan 2017 20:34:56 GMT"
from datetime import datetime from pytz import timezone dt = timezone('PST8PDT').localize(datetime(2017, 1, 1, 12, 34, 56)) from flask.json import JSONEncoder encoder = JSONEncoder() print(encoder.encode(dt))
The preceding code segment prints "Sun, 01 Jan 2017 12:34:56 GMT" instead, that is, local timetuple() appended with GMT.
"Sun, 01 Jan 2017 12:34:56 GMT"
The text was updated successfully, but these errors were encountered:
Add UTs for pallets#2372
8a98026
test_encode_aware_datetime() fails for non-UTC timezones due to the bug.
d75d83d
Successfully merging a pull request may close this issue.
flask.json.JSONEncoder()
encodes aware datetime objects in non-UTC timezone incorrectly using local time tuple with GMT.Expected Behavior
The following code segment should print
"Sun, 01 Jan 2017 20:34:56 GMT"
(12:34:56 PST8PDT is 20:34:56 GMT):Actual Behavior
The preceding code segment prints
"Sun, 01 Jan 2017 12:34:56 GMT"
instead, that is, local timetuple() appended with GMT.Environment
The text was updated successfully, but these errors were encountered: