Project

General

Profile

Actions

Defect #16482

open

Wrong search query for timelog, when timezone not UTC

Added by Alexander Maslov almost 10 years ago. Updated almost 2 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Time tracking
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Affected version:

Description

How to reproduce:

0. You are need to have server/devbox timezone set to UTC+X, where X is positive.
1. At 00:30 I'm create a timelog entry.
2. Right after this at a timelog reports page I'm select option to show only today timelog entries.
3. After pressing the search button, I'm can't see the timelog entry.
4. After the X time after 00:00, I'm can press the search button and can see the timelog entry as it need to be.

How to fix:

1. Replace all Date.today to Time.zone.today.

Patch: WIP, writing tests, investigating side effects.


Files


Related issues

Related to Redmine - Patch #22320: Respect user's timezone when comparing / parsing DatesClosedJean-Philippe Lang

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

Actions
Related to Redmine - Defect #23189: Spent time by filter, offset by one dayNew

Actions
Related to Redmine - Feature #23630: Migrate to Rails 5.2ClosedJean-Philippe Lang

Actions
Has duplicate Redmine - Defect #25822: 'Spent time' report is timezone-dependent (which it should not)Closed

Actions
Has duplicate Redmine - Defect #26156: Spent time not working correctly with user's zone different from system's time zoneClosed

Actions
Actions #1

Updated by Scott Macpherson over 9 years ago

I think I'm seeing the same issue manifesting itself in a slightly different way. The timezone on my Redmine server is set to UTC, and I've set config.active_record.default_timezone to :utc in config/enviroment.rb.

When I log work for local date 2014-10-01, but at a time when the UTC date is still 2014-09-30, attempting to view spent time where date is "today" doesn't return any results. Entering today's date rather than just "today" does return the correct records though.

Actions #2

Updated by Jens Krämer almost 8 years ago

patch in #22320

Actions #3

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

  • Related to Patch #22320: Respect user's timezone when comparing / parsing Dates added
Actions #4

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

  • Target version set to Candidate for next minor release
Actions #5

Updated by Toshi MARUYAMA almost 8 years ago

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

Updated by Toshi MARUYAMA almost 8 years ago

  • Status changed from New to Needs feedback
  • Target version deleted (Candidate for next minor release)

I think this issue is fixed by #22320, right?

Actions #7

Updated by Jamila Khan about 7 years ago

I'm afraid not.
We just upgraded to 3.3.2.stable from 3.1.2.stable and this issue just showed up.
This is still a problem.

Our server is set to GMT-5, and all date based queries done by users whose local time zone is set to GMT-6 through GMT-11 give incorrect days.
We have two workers in GMT-8 whose date based queries are not working.
Queries for tickets due "today" show tomorrow.
Changing the time zone to GMT-5 makes the issue disappear.

Environment:
Redmine version 3.3.2.stable
Ruby version 2.2.5-p319 (2016-04-26) [x86_64-linux]
Rails version 4.2.7.1
Environment production
Database adapter Mysql2

Please let me know if there are tests I can do that would help pinpoint the cause.

thanks,

Actions #8

Updated by Jamila Khan about 7 years ago

Example:
Server time zone GMT-5
User time zone set to GMT-8
Screenshot attached of query looking for tickets due 2/21/17, query returns tickets due 2/22/17.

Actions #9

Updated by Toshi MARUYAMA almost 7 years ago

  • Status changed from Needs feedback to New
Actions #10

Updated by Jamila Khan almost 7 years ago

Thank you for marking this as New, is there any other information that I can help provide for those who are able to fix this?
Does anyone know of a patch that I could apply in the meantime?

thanks,

Actions #11

Updated by Toshi MARUYAMA almost 7 years ago

  • Related to Defect #23189: Spent time by filter, offset by one day added
Actions #12

Updated by Jamila Khan almost 7 years ago

We just upgraded to 3.3.3.stable from 3.3.2.stable and this issue persists.

Actions #13

Updated by Marius BĂLTEANU almost 7 years ago

It seems to be a Rails bug:
https://github.com/rails/rails/issues/3145
https://github.com/rails/rails/issues/6816

I looked in the Redmine code and everything looks fine for me until this line: source:trunk/app/models/query.rb#L1295 which returns for the date Mon, 20 Feb 2017 23:59:59 AKST -09:00 the value 2017-02-21 08:59:59.999999. I used "(GMT-09:00) Alaska" for user timezone and GMT-5 on the server to reproduce the issue.

From what I understand, the issue is fixed on Rails 5.

Actions #14

Updated by Jamila Khan almost 7 years ago

Thank you!

It looks like Redmine doesn't support Rails 5 yet.
#23630

Actions #15

Updated by Jamila Khan almost 7 years ago

Is there any way to fix this other than upgrading to Rails 5, which doesn't seem possible yet?

Actions #16

Updated by Toshi MARUYAMA almost 7 years ago

Actions #17

Updated by Toshi MARUYAMA almost 7 years ago

  • Has duplicate Defect #25822: 'Spent time' report is timezone-dependent (which it should not) added
Actions #18

Updated by Jamila Khan almost 7 years ago

Thank you for relating this to the appropriate tickets.
That said, this is affecting the ability of our remote workers to effectively use redmine.
Does is appear there is anything we, as non-coders, could do other than wait for Redmine to support Rails 5?
It looks like #23630 is blocked by #19755 which looks pretty far down in the roadmap queue.

Actions #19

Updated by Toshi MARUYAMA almost 7 years ago

  • Has duplicate Defect #26156: Spent time not working correctly with user's zone different from system's time zone added
Actions #20

Updated by Martin Jungowski almost 7 years ago

Thank you Toshi for linking my ticket with this one. Despite searching for quite I while I somehonw failed to find this.

Anyway, I'm having the exact same problem. In addition to time zone it also seems to be affected by language selected in "My account"...

Actions #21

Updated by Tyrone Hattingh over 6 years ago

Hi there,

I just upgraded from 2.3.3 --> 3.4.3 (rails 4.2) -> latest version (rails 5.1) and this issue is still occurring, it does not appear to be an issue with Rails then. Any suggestions?

Actions #22

Updated by Jamila Khan about 6 years ago

This is still affecting the ability of our remote workers to effectively use redmine.
Thank you to those who have tested newer versions of rails.
To devs: is there more information that you would need from any of us in order to track down the cause of the bug?

Actions #23

Updated by Andrew Perry almost 2 years ago

This is still happening on 4.1.6

It is particularly annoying when you try to generate a list of entries for 'this month' or 'between' dates when in the Western Hemisphere, for a team working in the Eastern Hemisphere. You end up with entries displaying a date that is one day after the date range you selected so you have to manually adjust the 'between' dates accordingly.

The problem is compounded when you have contractors working across far east and far west and a few spots in between. When you want to pay them based on their hours, you have to be careful to avoid either missing a day or paying for the same day twice (especially if you are in a different timezone at the time of generating the report!).

It would be great to display the applicable timezone being used for the report on this page, and IDEAL if you could choose to change it (or otherwise work around it by changing your own timezone in your profile).

Is there any point updating here or should it be on the NEW #23189? Since that is 5 years old and included a patch that hasn't been applied, I am not sure that would make a difference...

Thanks for an overall great Free product - other than reporting the issue and providing patches, how can we help resolve this?

Actions

Also available in: Atom PDF