#27475: Bug in admin with date_hierarchy and Daylight savings
-------------------------------+------------------------------------
Reporter: Hugo Tácito | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 1.10
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by Aymeric Augustin):
* stage: Unreviewed => Accepted
Comment:
The problem seems to stem from the fact that Django wants dates, but
fetches them as datetimes, and applies the converter for datetimes, which
causes an exception in that case.
It isn't possible to represent "2016-10-16 in local time in São Paulo" as
`datetime.datetime(2016, 10, 16,
tzinfo=pytz.timezone('America/Sao_Paulo'))` because that value doesn't
exist. The only proper way to represent it is `datetime.date(2016, 10,
16)`.
I believe the resolution should be along the lines of making the year /
month / day truncation expressions cast their result to a DateField
instead of a DateTimeField. Reducing the problem to a lower-level test
case may help.
It seems possible that the same problem could occur with the hour
truncation expression if some time zones have their DST between 1:30 and
2:30. I'm not sure what we could do about that; it seems much harder to
fix.
--
Ticket URL: <https://code.djangoproject.com/ticket/27475#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 post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/068.0b6b612215432e4cbaf39597df687043%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.