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