Respect the user's timezone when querying issues
When querying issues and using date-based filters like "today" or "3 days ago" or "last month", Redmine uses the current date according to the server's local time as a reference. This might however not be the day in the user's timezone if they use a different one as the server. These queries can then show unexpected issues that do not match the filter according to the user's timezone.
Furthermore, even if the date is correct, the exact cut-off time still needs to be done in the user's timezone. Suppose the server is set to GMT and the user has configured Europe/Berlin (GMT+2:00 right now) as their time zone. When querying for all issues updated yesterday, the result should include all issues updated between 2015-08-03 02:00:00 GMT and 2015-08-04 01:59:59 GMT. Right now, it would however only include issues updated between 2015-08-03 00:00:00 GMT and 2015-08-03 23:59:59 GMT.
The attached patch against the current trunk fixes both of these issues by applying the following changes to the query model:
- It calculates the cut-of time based on the current user timezone instead of assuming midnight at server-local time
- it uses
Date.todayto get the correct reference day in the user's timezone
The patch was extracted from Planio.
#1 Updated by Toshi MARUYAMA about 3 years ago
Could you add tests?