October 30, 2017, 5:55pm
I’ve encountered very annoying problems when trying to filter
DateTime column for entities in a specified day. The only way I came up with was using custom filter and
dateEquals, but neither macro, nor the component respect user’s timezone. Scenario:
DB + JAVA Server in UTC
User is in GMT+1
Filter field with
Instead of filtering between 00:00 and 23:59 of users timezone, it filters the same range in server’s timezone - user gets results between 1:00 and 00:59 of the next day
We needed to fix it by overriding
com.haulmont.cuba.core.sys.querymacro.DateEqualsMacroHandler. Cuba handles user’s TimeZone in other place well, this is a real shame!
November 1, 2017, 6:24am
Could you share your code or make a pull request?
November 6, 2017, 4:09pm
my colleague create a pull request, feel free to integrate it:
04:03PM - 06 Nov 17 UTC
Fix adding user timezone awareness into dateEquals macro.
One test is not passing anymore. I think it is due to non initialized AppContext.
November 8, 2017, 10:50am
Thank you. Please see my comments in the PR discussion. There is also a related
November 8, 2017, 11:10am
Fair enough. We sadly do not have time to go through other truncating macros and as this was irritating our customer we had to deal with it somehow. I hope the PR have helped you a bit.
November 8, 2017, 11:32am
Sure, it clearly defines the problem and a possible solution. But I have no idea at the moment how to save other use cases with date parameter from breaking.
December 27, 2022, 11:44am
Hello Konstantin, I am currently struggling with this very same issue, was there another way of solving this problem found?
December 27, 2022, 1:09pm
Unfortunately I cannot add anything to this old discussion.
December 27, 2022, 3:50pm
I click on the link to the similar issue you refer to in post
#4 but YouTrack does not seem to find it, is there a back-up or some documentation on it?
December 28, 2022, 6:19am
The link to the issue is broken now, we’ll fix it soon. Thanks for pointing this out.
But looks like the issue was fixed for CUBA v.6.8.0.
What version are you using?
December 28, 2022, 1:35pm
We are currently using CUBA v.7.2.15.
December 28, 2022, 2:38pm
OK, then you should use the
user_timezone parameter in date-time macros as described in the