DateRangeFilter didn't give the correct result because of timezone difference. #1464
Replies: 2 comments 2 replies
-
Hi. As per Django's Time Zones docs you/we want to do all (storage and) filtering in UTC. So, I think the current behaviour is correct, but there's the question of how you map to/from the local value you want in the UI. This is about making sure the widget you use gives you the right value. I'd need a fuller example to be able to say more. I will convert this to a discussion, since I don't (yet) think it's an issue. |
Beta Was this translation helpful? Give feedback.
-
It's worth looking at the related Django ticket (and the discussion there) for TZ aware widgets in the Admin https://code.djangoproject.com/ticket/29822 |
Beta Was this translation helpful? Give feedback.
-
For example, I am in Hong Kong and now is
2021-12-14 06:46:19
.I filtered all instances with
date=today
, but the filter didn't give me instances withdate=2021-12-14
butdate=2021-12-13
as thenow()
which is used inDateRangeFilter
gives2021-12-13 22:46:19
.This is quite frustrating. Please help.
The alternative I propose is to have
localtime()
being used instead ofnow()
inDataRangeFilter
.Thank you!
Beta Was this translation helpful? Give feedback.
All reactions