#32147: timezone error when casting a naive date in a Daylight Saving Time
Change
----------------------------+--------------------------------------
Reporter: WolfTammer | Owner: nobody
Type: Bug | Status: closed
Component: Utilities | Version: 3.1
Severity: Normal | Resolution: invalid
Keywords: timezone | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
----------------------------+--------------------------------------
Comment (by WolfTammer):
Replying to [comment:5 Aymeric Augustin]:
> I can confirm. "Don't use pytz" will eventually lead to "assume the
value is in DST / not in DST", which we want to avoid. The error is raised
on purpose because the input is ambiguous.
>
> If you care about such values, you should write an input that includes
time zone information. No one does this in practice because the problem
only happens one hour per year.
>
> If you want the whole history, look at #2626 and related mailing-list
discussions.
I should write another ticket or modify this with other unittest. My
problem is not when you create an object with an aware datetime, I can
understand you waypoint in that case, BUT the error comes when I **save a
datetime with timezone**, then I try to retrieve the datetime **from DB**.
It should work, because I specified the timezone in the database settings.
I don't think doing a timezone.localize() is a good idea, instead it
should be done a replace(tzinfo=timezone) because we are sure that
database data is in that timezone. Should I open another ticket or modify
this? Or is also a correct behaviour this one?
--
Ticket URL: <https://code.djangoproject.com/ticket/32147#comment:6>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/064.ea46976757ee467663936d8932441773%40djangoproject.com.