[Django] #30749: Admin date_hierarchy filter by month of October 2019 does not include October 31th when TZ is set to Europe/Paris (UTC+2)

18 views
Skip to first unread message

Django

unread,
Sep 2, 2019, 5:52:21 PM9/2/19
to django-...@googlegroups.com
#30749: Admin date_hierarchy filter by month of October 2019 does not include
October 31th when TZ is set to Europe/Paris (UTC+2)
-------------------------------------+-------------------------------------
Reporter: yab | Owner: nobody
Type: Bug | Status: new
Component: | Version: 2.2
contrib.admin | Keywords: timezone daylight
Severity: Normal | saving time
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
Steps to reproduces:
- set USE_TZ = True and TIME_ZONE = 'Europe/Paris' in settings
- use sqlite db
- Create a model (Event) with a datefield
- Create modelAdmin (EventAdmin) with date_hierarchy on that datefield
- Create an Event on 2019-10-31 (or 2018-10-31)
- Filter by date_hierarchy on Admin list page : it does not include that
Event.

Probably linked to the fact that the DST in Paris is in october (Sunday
2019-10-27) while in others Timezones it is in November (Sunday
2019-03-11).
Bug maybe due to pytz ?
Bug maybe due to the way date_hierarchy calculates date range in
django/contrib/admin/views/main.py (lines 164-167)
{{{
elif month:
# In this branch, from_date will always be the first
of a
# month, so advancing 32 days gives the next month.
to_date = (from_date +
timedelta(days=32)).replace(day=1)
}}}

can be uncorrectly fixed by setting:
{{{
to_date = (from_date + timedelta(days=32, hours = XXX)).replace(day=1)
}}}
where XXX = 3 (or something like that)

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

Django

unread,
Sep 3, 2019, 2:11:08 AM9/3/19
to django-...@googlegroups.com
#30749: Admin date_hierarchy filter by month of October 2019 does not include
October 31th when TZ is set to Europe/Paris (UTC+2)
-------------------------------------+-------------------------------------
Reporter: yab | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 2.2
Severity: Normal | Resolution:
Keywords: timezone daylight | Triage Stage:
saving time | Unreviewed
Has patch: 0 | Needs documentation: 0

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

Comment (by Carlton Gibson):

Duplicate of #29724.

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

Django

unread,
Sep 3, 2019, 2:11:21 AM9/3/19
to django-...@googlegroups.com
#30749: Admin date_hierarchy filter by month of October 2019 does not include
October 31th when TZ is set to Europe/Paris (UTC+2)
-------------------------------------+-------------------------------------
Reporter: yab | Owner: nobody
Type: Bug | Status: closed
Component: contrib.admin | Version: 2.2
Severity: Normal | Resolution: duplicate

Keywords: timezone daylight | Triage Stage:
saving time | Unreviewed
Has patch: 0 | Needs documentation: 0

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

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


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

Django

unread,
Sep 3, 2019, 6:43:41 AM9/3/19
to django-...@googlegroups.com
#30749: Admin date_hierarchy filter by month of October 2019 does not include
October 31th when TZ is set to Europe/Paris (UTC+2)
-------------------------------------+-------------------------------------
Reporter: yab | Owner: nobody
Type: Bug | Status: closed
Component: contrib.admin | Version: 2.2
Severity: Normal | Resolution: duplicate
Keywords: timezone daylight | Triage Stage:
saving time | Unreviewed
Has patch: 0 | Needs documentation: 0

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

Comment (by yab):

Replying to [comment:2 Carlton Gibson]:
Hello, thanks for reading this ticket. It may be a different problem than
the #29724 ticket. I just told it to ahbk on github (/django/pull/10380).

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

Django

unread,
Sep 3, 2019, 9:17:04 AM9/3/19
to django-...@googlegroups.com
#30749: Admin date_hierarchy filter by month of October 2019 does not include
October 31th when TZ is set to Europe/Paris (UTC+2)
-------------------------------------+-------------------------------------
Reporter: yab | Owner: nobody
Type: Bug | Status: closed
Component: contrib.admin | Version: 2.2
Severity: Normal | Resolution: duplicate
Keywords: timezone daylight | Triage Stage:
saving time | Unreviewed
Has patch: 0 | Needs documentation: 0

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

Comment (by Carlton Gibson):

Hi yab.

Seems similar enough: both have a incorrect result on the boundary
condition. If you can add a test case showing your particular case to the
other ticket, or the PR on GitHub, we can make sure that it passes for any
proposed solution. Happy to re-open a separate ticket if we can pin down
that there are actually two bugs, but it doesn't look that way with what
we have right now. (I think 🙂)

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

Django

unread,
Sep 3, 2019, 6:38:21 PM9/3/19
to django-...@googlegroups.com
#30749: Admin date_hierarchy filter by month of October 2019 does not include
October 31th when TZ is set to Europe/Paris (UTC+2)
-------------------------------------+-------------------------------------
Reporter: yab | Owner: nobody
Type: Bug | Status: closed
Component: contrib.admin | Version: 2.2
Severity: Normal | Resolution: duplicate
Keywords: timezone daylight | Triage Stage:
saving time | Unreviewed
Has patch: 0 | Needs documentation: 0

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

Comment (by yab):

Hi Carlton,
Below ticket #29724, I just proposed two solutions to those two distinct
(I think) issues, one in templatestags/admin_list.py and one
views/mains.py.

Replying to [comment:4 Carlton Gibson]

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

Django

unread,
Mar 25, 2020, 8:01:19 AM3/25/20
to django-...@googlegroups.com
#30749: Admin date_hierarchy filter by month of October 2019 does not include
October 31th when TZ is set to Europe/Paris (UTC+2)
-------------------------------------+-------------------------------------
Reporter: yab | Owner: nobody
Type: Bug | Status: closed
Component: contrib.admin | Version: 2.2
Severity: Normal | Resolution: duplicate
Keywords: timezone daylight | Triage Stage:
saving time | Unreviewed
Has patch: 0 | Needs documentation: 0

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

Comment (by felixxm):

That's rather a duplicate of #30922.

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

Reply all
Reply to author
Forward
0 new messages