Wrong search query for timelog, when timezone not UTC
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.
#1 Updated by Scott Macpherson about 8 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
: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.
#7 Updated by Jamila Khan over 5 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.
Redmine version 3.3.2.stable
Ruby version 2.2.5-p319 (2016-04-26) [x86_64-linux]
Rails version 22.214.171.124
Database adapter Mysql2
Please let me know if there are tests I can do that would help pinpoint the cause.
#13 Updated by Marius BALTEANU over 5 years ago
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.
#18 Updated by Jamila Khan over 5 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.
#20 Updated by Martin Jungowski over 5 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"...
#22 Updated by Jamila Khan almost 5 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?
#23 Updated by Andrew Perry 6 months 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?