-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrect DateTime filtering #395
Comments
When I'm trying to do it in the next way: var val1 = new DateTimeOffset(new DateTime(model.FromDate.Value.Ticks)); I'm receiving an error: StackTrace: |
Try to
So, you no longer need to |
Thanks for the option, but few comments on that:
|
Event if I'm trying to parse the date in the next way:
And use it in the query, it's anyway working incorrectly. Value in the query applies to my timezone 2023-06-28 00:00:00.000 - 8h. I have no idea why, but it's working correctly if I wrapping DateTime like that:
|
Hi @AlexanderAnatolich - yeah so if you are querying with |
Versions:
.Net 6
Redis OM 0.5.2
Redis modules:
Redis search 2.4.16
Redis JSON 2.2.0
Steps to reproduce:
Create models, like that:
Insert list of entities to Redis
In Redis you should have the next data:
Pass the next filter:
model.ToDate (6/28/2023 12:00:00 AM) (2023-06-28T00:00:00.000Z) have the next ticks 638235072000000000
model.FromDate (6/27/2023 12:00:00 AM) (2023-06-27T00:00:00.000Z) have the next ticks 638234208000000000
Execute it the next way:
Actual result:
Items with id 1 and id 2 are returned
Expected result:
The only item with id 2 is returned
Comments
The Redis receives an execution command like that:
FT.SEARCH SomeModel ((@EventDate:[-inf 1687910400000])
(@EventDate:[1687824000000 inf])) LIMIT 0 1000
I think the problem is related to time convertation.
Because when I tried to execute the same code from Redis.OM.Modeling.DateTimeJsonConverter, it returns another result:
but in the query, I have another value 1687824000000
The text was updated successfully, but these errors were encountered: