Completed
Last Updated: 23 May 2022 09:48 by ADMIN
Release 3.4.0
Robert
Created on: 16 May 2022 16:14
Category: Grid
Type: Bug Report
0
ToODataString() method incorrectly serializes nullable DateTime filter value

When a filter descriptor is created and the value is of type DateTime? (nullable DateTime) the serialized value is incorrect.

    DataSourceRequest request1 = new()
    {
         Filters = new[] {new FilterDescriptor("Test", FilterOperator.IsEqualTo, DateTime.Now.Date) {MemberType = typeof(DateTime)}},
         Sorts = new List<SortDescriptor>()
    };

    DataSourceRequest request2 = new()
    {
         Filters = new[] { new FilterDescriptor("Test", FilterOperator.IsEqualTo, DateTime.Now.Date) { MemberType = typeof(DateTime?) } },
         Sorts = new List<SortDescriptor>()
    };

    string query1 = request1.ToODataString(); // outputs $count=true&$filter=(Test%20eq%202022-05-12T00:00:00.0000000Z)&$skip=0
    string query2 = request2.ToODataString(); // outputs $count=true&$filter=(Test%20eq%202022-05-12%2000:00:00)&$skip=0

 

0 comments