Skip to content

DateOnly field cannot be filtered in a Grid configured for OData binding #8083

@kendo-bot

Description

@kendo-bot

Bug report

When the Grid is set up for OData-v4 binding, the columns that bind to DateOnly fields fail to filter. The date value in the filter expression contains the time portion and the following error is thrown:

"The binary operator GreaterThan is not defined for the types 'System.Nullable1[System.DateOnly]' and 'System.Nullable1[System.DateTimeOffset]'."

Reproduction of the problem

  1. Create a Grid that uses OData-v4 binding.
  2. Bind a specified column to a DateOnly field.
  3. Filter the column through the default column filter menu and open the browser DevTools to review the response of the request.
//Model
public DateOnly LastProdUpdate { get; set; }

//View
@(Html.Kendo().Grid<ProductViewModel>()
    .Name("grid")
     .Columns(columns =>
        {
            columns.Bound(p => p.LastProdUpdate).Format("{0:dd/MM/yyyy}");
        })
        ...
        .Filterable()
        .DataSource(dataSource => dataSource
        .Custom()
        .Type("odata-v4")
        .Transport(t =>
        {
            t.Read(read => read.Url("/odata/Products").Data("function() {return {'$expand': 'Employee'} }"));
        })
        .PageSize(10)
        .ServerPaging(true)
        .ServerFiltering(true)
        .ServerSorting(true)
     )
)

Expected/desired behavior

The DateOnly fields must be filtered successfully as the DateTime fields.

Environment

  • **Kendo UI version: 2024.4.1112
  • **Browser: [all]

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions