#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.
--
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/046.ecf172078962c1820cd3d9651dec0ba9%40djangoproject.com.