Defect #23189

Spent time by filter, offset by one day

Added by Mentel Inc almost 2 years ago. Updated 3 months ago.

Status:NewStart date:
Priority:HighDue date:
Assignee:-% Done:

0%

Category:Time tracking
Target version:-
Resolution: Affected version:3.3.0

Description

We just upgrade to 3.3.0.stable.

If you log time today (June28) and then go in spent time, filter by today, the logged time isn't showing up. If you do yesterday, it shows up with the today's date (June28).

Same issue in the project time logs.

However, if you select All, it works.

I tried to see if someone else had reported it, I couldn't find it, if it's the case I'm sorry in advance.

Screen_Shot_2016-06-28_at_3_46_58_PM.jpg (131 KB) Mentel Inc, 2016-06-28 21:49

2017-04-17_10h00_03.jpg (137 KB) Andrey Krot, 2017-04-17 05:01

20180329_use_local_time_in_date_query.patch Magnifier (519 Bytes) Steve Karrmann, 2018-03-29 18:11


Related issues

Related to Redmine - Patch #22320: Respect user's timezone when comparing / parsing Dates Closed
Related to Redmine - Defect #16482: Wrong search query for timelog, when timezone not UTC New
Duplicated by Redmine - Defect #24547: Spent Time Date Filter Off by 1 Day Closed

History

#1 Updated by Manuel Reinhardt almost 2 years ago

Same problem here, also on 3.3.0.stable. Workaround: I get correct results if I set the time zone in my account to the one used on the server.

#2 Updated by Mentel Inc almost 2 years ago

Manuel Reinhardt wrote:

Same problem here, also on 3.3.0.stable. Workaround: I get correct results if I set the time zone in my account to the one used on the server.

I confirm, this turn around works perfectly.

Thanks Manu

#3 Updated by Jean-Philippe Lang almost 2 years ago

This is related to #22320. Date filters now take care of timezones.

Workaround: I get correct results if I set the time zone in my account to the one used on the server.

Did you get incorrect results when leaving your timezone blank in your Redmine account?

#4 Updated by Jean-Philippe Lang almost 2 years ago

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

#5 Updated by Lucas Nogueira over 1 year ago

hello,

I am also this problem .. Anyone know any way to fix?

Thanks!

#6 Updated by Go MAEDA over 1 year ago

  • Duplicated by Defect #24547: Spent Time Date Filter Off by 1 Day added

#7 Updated by Jamila Khan over 1 year ago

I put my documentation in #16482-7, we are having this issue as well.
Is there more documentation that is needed that would help figure out the cause?

thanks,

#8 Updated by Toshi MARUYAMA about 1 year ago

  • Related to Defect #16482: Wrong search query for timelog, when timezone not UTC added

#9 Updated by Andrey Krot about 1 year ago

+
The same issue in tasks filter.
Control reports work incorrect.

#10 Updated by Phlip Plumlee 4 months ago

We have this bug, with version 3.4.2.stable.

On our server, with the UTC timezone, the Query system generates SQL that seems to compare a date by time adjusted by the timezone in my preferences (PST): time_entries.spent_on >= '2018-01-09 07:59:59.999999' AND time_entries.spent_on <= '2018-01-10 07:59:59.999999'. I'm trying for January 9th, there, and MySQL presumably converts a date of '2018-01-09' to a datetime of "midnight".

On my notebook, set to PST, the query is correct: time_entries.spent_on > '2018-01-14 23:59:59.999999' AND time_entries.spent_on <= '2018-01-15 23:59:59.999999'. I get the records I'm looking for, on '2018-01-15'.

When I erase my timezone from my Preferences on the server, the problem goes away.

I could fix this myself, as soon as I figure out where in the Query system that line gets generated...

#11 Updated by Steve Karrmann 3 months ago

We encountered this issue as well. Date filters were returning results off by one day, but only for users with a time zone specified in their account settings.

Our solution was to disable the time zone handling in class app/models/query.rb function date_for_user_time_zone - see attached patch.

With this change, all date filters return the correct dates, even for users with a time zone specified.

Also available in: Atom PDF