[OBSOLETE] Datetime filtering doesn't work

BUG REPORT
I have downloaded and compiled Squidex version 1.10.0. I am using self-hosted Windows 2016 server, IIS and dotNet.Core 2.1 hosting bundle. Everything works and looks ok except filtering on datatime fields. Whatever filter condition I am writing it is always evaluates to false. I mean that a query with filter condition: $filter=data/validFrom/iv gt 2018-08-15T21:54:12Z will always return an empty result set, no matter the filter date-time or data in database. If I am using only date in the filter condition ($filter=data/validFrom/iv gt 2018-08-15) everything works. But it is not that I need.

It is the same issue described in [SOLVED] Result between dates, but this issue closed as not reproducible.

At the moment I have solved the issue by small change in source code, but I am not sure it is done in correct way. I made changes in ConvertValue method of FindExtensions class (squidex-1.10.0\src\Squidex.Domain.Apps.Entities.MongoDb\Contents\Visitors\FindExtensions.cs)

After my change method looks like this:

        public static readonly ConvertValue ValueConverter = (field, value) =>
        {
            if (value is Instant instant &&
                !string.Equals(field, "mt", StringComparison.OrdinalIgnoreCase) &&
                !string.Equals(field, "ct", StringComparison.OrdinalIgnoreCase))
            {
                return instant.ToString();
            }

//--- the change -----
            if (value is DateTimeOffset dateTimeOffestValue)
            {
                return dateTimeOffestValue.ToUniversalTime().ToString("o");
            }
//-- end of the change ----

            return value;
        };

Best regards,

Rolandas

I will have a look. Can you please fix the formatting? You can use ``` and ` for code.

Sorry, I accidentally deleted your post. I just wanted to answer and clicked the wrong button. Was not by purpose.

I found the button to get your version back :slight_smile:

Would be great if you can migrate to the newest version, so that i do not have to invest the time to provide a patch for the old version.

I have marked the bug as deprecated, just for my personal note.

Hi,

Yes I will migrate to newest version :slightly_smiling_face:

BR,

Rolandas