Admin's date list filter's "This month/year" and "Today" are incorrect when USE_TZ is set (with the postgres backend).
|Reported by:||Glenn Washburn <development@…>||Owned by:||nobody|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
Description (last modified by julien)
This may be applicable to other backends, but I'm not sure.
When using USE_TZ the backend connection is set to use UTC. So __year/__month/__day lookup filters will filter where the UTC timestamp has a year/month/day of the lookup value. However, what's really desired is to use the timestamp at the current timezone. For example, the current code when filtering for "today" datetimes which are not in UTC can potentially return a list of matching records where the set of days being displayed is more than one.
Change History (4)
comment:1 Changed 4 years ago by julien
- Description modified (diff)
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
- Severity changed from Normal to Release blocker
comment:3 Changed 4 years ago by aaugustin
- Resolution set to duplicate
- Status changed from new to closed