Skip to content
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

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

Open
kendo-bot opened this issue Dec 23, 2024 · 0 comments
Open

Comments

@kendo-bot
Copy link
Collaborator

kendo-bot commented Dec 23, 2024

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]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants