Project

General

Profile

Actions

Patch #20473

closed

Respect the user's timezone when querying issues

Added by Holger Just over 8 years ago. Updated about 8 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Issues
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:

Description

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 User.current.today instead of Date.today to get the correct reference day in the user's timezone

The patch was extracted from Planio.


Files


Related issues

Related to Redmine - Defect #19033: Filters that utilize date/time ignore user's UTC offsetClosed

Actions
Is duplicate of Redmine - Patch #22320: Respect user's timezone when comparing / parsing DatesClosedJean-Philippe Lang

Actions
Actions #1

Updated by Toshi MARUYAMA over 8 years ago

Actions #2

Updated by Sebastian Paluch about 8 years ago

+1

The same issue exists on spent time queries.

Actions #3

Updated by Toshi MARUYAMA about 8 years ago

  • Related to Defect #19033: Filters that utilize date/time ignore user's UTC offset added
Actions #4

Updated by Jens Krämer about 8 years ago

In #22320 there's a patch which includes the changes we proposed here, plus some tests and a global replacement of Date.today with User.current.today.

Actions #5

Updated by Jan from Planio www.plan.io about 8 years ago

  • Status changed from New to Closed

Closing this in favor of #22320, since the patch proposed there includes this one.

Actions #6

Updated by Jan from Planio www.plan.io about 8 years ago

  • Is duplicate of Patch #22320: Respect user's timezone when comparing / parsing Dates added
Actions

Also available in: Atom PDF