Filter Broken for DateTimeOffset Column

2 posts, 0 answers
  1. Aleks
    Aleks avatar
    33 posts
    Member since:
    Nov 2018

    Posted 04 Feb Link to this post

    When using a date filter on a column bound to a DateTimeOffset property, the filter is missing all its options.

    The property:

    public DateTimeOffset Created { get; set; }

     

    The column definition:

    c.Bound(x => x.Created)
    .Filterable(f => f
    .Operators(o => o.ForDate(d => d.Clear().IsGreaterThanOrEqualTo("On or after").IsLessThan("Before")))
    .Extra(true)
    .UI(GridFilterUIRole.DateTimePicker)
    );

     

    When the property type is changed to DateTime, the filter works as expected.

    See the attached images. (The operator dropdown just shows "NO DATA FOUND").

    No errors are reported in the console.

    Using:

    <PackageReference Include="Telerik.UI.for.AspNet.Core" Version="2021.1.119" />

        "@progress/kendo-theme-bootstrap": "^4.30.0",
        "@progress/kendo-theme-default": "^4.32.0",
        "@progress/kendo-ui": "^2021.1.119",

     

  2. Patrick
    Admin
    Patrick avatar
    255 posts

    Posted 09 Feb Link to this post

    Hello Aleks,

    In order to use the DateTimeOffSet within a Kendo UI Grid, the property will need to be mapped to a view model of type DateTime.  We have a dedicated Kendo UI Knowledge Base Article regarding how to resolve this as well as a runnable GitHub example which demonstrates one way to do this.    

    Once the ViewModel containing the DateTime property is utilized, the filtering works as expected in the Kendo UI Grid:

    I hope this information helps.  Please let me know if you have any questions regarding the matter.

    Regards,
    Patrick
    Progress Telerik

    Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Back to Top