Skip to content
New issue

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

Fix timezone handling for DateTimeField #5408

Closed
wants to merge 3 commits into from

Conversation

rpkilby
Copy link
Member

@rpkilby rpkilby commented Sep 11, 2017

This should fix #3732, as well as the current/active timezone handling mentioned by @RichardForshaw.

Ryan P Kilby added 3 commits September 11, 2017 04:56
@@ -1165,7 +1170,7 @@ class TestDateTimeField(FieldValues):
datetime.date(2001, 1, 1): ['Expected a datetime but got a date.'],
}
outputs = {
datetime.datetime(2001, 1, 1, 13, 00): '2001-01-01T13:00:00',
datetime.datetime(2001, 1, 1, 13, 00): '2001-01-01T13:00:00Z',
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Side note - changed the datetime output from unaware to aware/UTC datetime, since the field itself is datetime-aware.

Copy link
Collaborator

@carltongibson carltongibson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great. @rpkilby happy for you to merge when you’re ready. (Not sure if you want to wait for confirmation.)

Nice!

@carltongibson carltongibson added this to the 3.6.5 Release milestone Sep 11, 2017
@rpkilby
Copy link
Member Author

rpkilby commented Sep 12, 2017

Yeah, I'll give it a few days for confirmation.

@tomchristie
Copy link
Member

Seems good. Will we want to mention any behavioral changes here in the release notes?

@rpkilby
Copy link
Member Author

rpkilby commented Sep 14, 2017

Timezone-aware `DateTimeField`s now respect their `timezone` during serialization, instead of using UTC. 

@tomchristie
Copy link
Member

tomchristie commented Sep 18, 2017

@rpkilby - Okay, we'll want to think this over slightly when we come to writing the release notes. Needs to be a little clearer I think.

@tomchristie
Copy link
Member

(Otherwise great tho!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Serializer DateTimeField has unexpected timezone information
5 participants