[Django] #30922: admin date_hierarchy excludes 31 october when using timezone with DST in northern hemisphere

8 views
Skip to first unread message

Django

unread,
Oct 28, 2019, 10:08:05 AM10/28/19
to django-...@googlegroups.com
#30922: admin date_hierarchy excludes 31 october when using timezone with DST in
northern hemisphere
-----------------------------------------+--------------------------------
Reporter: Erwin Junge | Owner: nobody
Type: Uncategorized | Status: new
Component: contrib.admin | Version: 2.2
Severity: Normal | Keywords: date_hierarchy
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-----------------------------------------+--------------------------------
https://code.djangoproject.com/ticket/28933 introduced a subtle bug where
it accidentally excludes 31 october in the admin date_hierarchy filter
after selecting october. The underlying reason is that the generated sql
has `< 2019-10-31` as opposed to `< 2019-11-01` as it should be. This in
turn is caused by applying the timezone for 2019-10-01 (with DST in
countries in the northern hemisphere) to the date used for 2019-11-01.
This causes the date conversion to actually operate on 2019-10-31 23:00
instead of 2019-11-01 00:00. It's a bit hard to explain in words, PR
incoming that hopefully explains better in code.

--
Ticket URL: <https://code.djangoproject.com/ticket/30922>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Oct 28, 2019, 10:08:34 AM10/28/19
to django-...@googlegroups.com
#30922: admin date_hierarchy excludes 31 october when using timezone with DST in
northern hemisphere
--------------------------------+---------------------------------------
Reporter: Erwin Junge | Owner: Erwin Junge
Type: Uncategorized | Status: assigned
Component: contrib.admin | Version: 2.2
Severity: Normal | Resolution:

Keywords: date_hierarchy | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+---------------------------------------
Changes (by Erwin Junge):

* owner: nobody => Erwin Junge
* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/30922#comment:1>

Django

unread,
Oct 28, 2019, 10:15:13 AM10/28/19
to django-...@googlegroups.com
#30922: admin date_hierarchy excludes 31 october when using timezone with DST in
northern hemisphere
--------------------------------+---------------------------------------
Reporter: Erwin Junge | Owner: Erwin Junge
Type: Uncategorized | Status: assigned
Component: contrib.admin | Version: 2.2
Severity: Normal | Resolution:

Keywords: date_hierarchy | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+---------------------------------------

Comment (by Erwin Junge):

[https://github.com/django/django/pull/11983]

--
Ticket URL: <https://code.djangoproject.com/ticket/30922#comment:2>

Django

unread,
Oct 28, 2019, 10:15:56 AM10/28/19
to django-...@googlegroups.com
#30922: admin date_hierarchy excludes 31 october when using timezone with DST in
northern hemisphere
--------------------------------+---------------------------------------
Reporter: Erwin Junge | Owner: Erwin Junge
Type: Uncategorized | Status: assigned
Component: contrib.admin | Version: 2.2
Severity: Normal | Resolution:

Keywords: date_hierarchy | Triage Stage: Unreviewed
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+---------------------------------------
Changes (by Erwin Junge):

* has_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/30922#comment:3>

Django

unread,
Oct 28, 2019, 10:24:26 AM10/28/19
to django-...@googlegroups.com
#30922: admin date_hierarchy excludes 31 october when using timezone with DST in
northern hemisphere
--------------------------------+---------------------------------------
Reporter: Erwin Junge | Owner: Erwin Junge
Type: Uncategorized | Status: assigned
Component: contrib.admin | Version: 2.2
Severity: Normal | Resolution:
Keywords: date_hierarchy | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+---------------------------------------
Changes (by Erwin Junge):

* stage: Unreviewed => Accepted


--
Ticket URL: <https://code.djangoproject.com/ticket/30922#comment:4>

Django

unread,
Oct 28, 2019, 10:26:40 AM10/28/19
to django-...@googlegroups.com
#30922: admin date_hierarchy excludes 31 october when using timezone with DST in
northern hemisphere
--------------------------------+---------------------------------------
Reporter: Erwin Junge | Owner: Erwin Junge
Type: Uncategorized | Status: assigned
Component: contrib.admin | Version: 2.2
Severity: Normal | Resolution:

Keywords: date_hierarchy | Triage Stage: Unreviewed
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+---------------------------------------
Changes (by felixxm):

* stage: Accepted => Unreviewed


Comment:

Please don't accept your own tickets.

--
Ticket URL: <https://code.djangoproject.com/ticket/30922#comment:5>

Django

unread,
Oct 28, 2019, 10:27:19 AM10/28/19
to django-...@googlegroups.com
#30922: Admin's date_hierarchy excludes 31 october when using timezone with DST in
northern hemisphere.

--------------------------------+---------------------------------------
Reporter: Erwin Junge | Owner: Erwin Junge
Type: Bug | Status: assigned
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: date_hierarchy | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+---------------------------------------
Changes (by felixxm):

* version: 2.2 => master
* type: Uncategorized => Bug


* stage: Unreviewed => Accepted


Comment:

Great catch.

--
Ticket URL: <https://code.djangoproject.com/ticket/30922#comment:6>

Django

unread,
Oct 29, 2019, 3:42:30 AM10/29/19
to django-...@googlegroups.com
#30922: Admin's date_hierarchy excludes 31 october when using timezone with DST in
northern hemisphere.
--------------------------------+---------------------------------------
Reporter: Erwin Junge | Owner: Erwin Junge
Type: Bug | Status: closed
Component: contrib.admin | Version: master
Severity: Normal | Resolution: duplicate

Keywords: date_hierarchy | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+---------------------------------------
Changes (by Carlton Gibson):

* status: assigned => closed
* resolution: => duplicate


Comment:

I think this is a Duplicate of #29724. (I'm going to close as such. Erwin
please review and re-open/reply here/there if that's incorrect.)

--
Ticket URL: <https://code.djangoproject.com/ticket/30922#comment:7>

Django

unread,
Oct 29, 2019, 3:55:31 AM10/29/19
to django-...@googlegroups.com
#30922: Admin's date_hierarchy excludes 31 october when using timezone with DST in
northern hemisphere.
--------------------------------+---------------------------------------
Reporter: Erwin Junge | Owner: Erwin Junge
Type: Bug | Status: closed
Component: contrib.admin | Version: master
Severity: Normal | Resolution: duplicate
Keywords: date_hierarchy | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+---------------------------------------

Comment (by felixxm):

I don't think that it's a duplicate. This one is strictly related with
DST, i.e. `date_hierarchy` uses date `2019-11-01+03:00` instead of
`2019-11-01+02:00` (that doesn't exist in this timezone) because `date_to`
is in DST and `date_from` is not.

--
Ticket URL: <https://code.djangoproject.com/ticket/30922#comment:8>

Django

unread,
Oct 29, 2019, 4:56:48 AM10/29/19
to django-...@googlegroups.com
#30922: Admin's date_hierarchy excludes 31 october when using timezone with DST in
northern hemisphere.
--------------------------------+---------------------------------------
Reporter: Erwin Junge | Owner: Erwin Junge
Type: Bug | Status: new
Component: contrib.admin | Version: master
Severity: Normal | Resolution:

Keywords: date_hierarchy | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+---------------------------------------
Changes (by Carlton Gibson):

* status: closed => new
* resolution: duplicate =>


Comment:

OK, happy to re-open if you think they're separate.

--
Ticket URL: <https://code.djangoproject.com/ticket/30922#comment:9>

Django

unread,
Oct 29, 2019, 6:39:27 AM10/29/19
to django-...@googlegroups.com
#30922: Admin's date_hierarchy excludes 31 october when using timezone with DST in
northern hemisphere.
-------------------------------------+-------------------------------------

Reporter: Erwin Junge | Owner: Erwin
| Junge
Type: Bug | Status: new
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: date_hierarchy | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by felixxm):

* stage: Accepted => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/30922#comment:10>

Django

unread,
Oct 29, 2019, 7:12:22 AM10/29/19
to django-...@googlegroups.com
#30922: Admin's date_hierarchy excludes 31 october when using timezone with DST in
northern hemisphere.
-------------------------------------+-------------------------------------
Reporter: Erwin Junge | Owner: Erwin
| Junge
Type: Bug | Status: closed
Component: contrib.admin | Version: master
Severity: Normal | Resolution: fixed

Keywords: date_hierarchy | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak <felisiak.mariusz@…>):

* status: new => closed
* resolution: => fixed


Comment:

In [changeset:"a6cb8ec3895a72bfb7f8e62d4b05dd5de6b738af" a6cb8ec]:
{{{
#!CommitTicketReference repository=""
revision="a6cb8ec3895a72bfb7f8e62d4b05dd5de6b738af"
Fixed #30922 -- Fixed ModelAdmin.date_hierarchy queries with DST changes.

There was an issue where admin date_hierarchy didn't render last day of
a month in DST-switch month.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/30922#comment:11>

Reply all
Reply to author
Forward
0 new messages