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 over 4 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 about 2 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 220.127.116.11
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 about 2 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 almost 2 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 almost 2 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 over 1 year 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?