Date filter doesn't ignore the time

3 posts, 0 answers
  1. Dana
    Dana avatar
    1 posts
    Member since:
    Mar 2013

    Posted 28 Mar 2013 Link to this post

    When filtering on a date column in the grid, the dates are filtered by time as well as by date. This creates a problem when trying to filter with "equals to". 
    I can easily remove the time from the date object in the grid and this fixes the filtering.
    However, I might need to display the time in the date object in the grid. 

    How can I have the dates filtered while ignoring the time, or alternatively display the date with the time, but filter with a date object without the time?

    Thanks
  2. Jayesh Goyani
    Jayesh Goyani avatar
    2732 posts
    Member since:
    May 2010

    Posted 29 Mar 2013 Link to this post

    Hello,

    I think it is not possible or very hard to achieve this thing in in-built filter functionality.

    Please try with Custom Filter.

    http://www.kendoui.com/forums/ui/grid/grid-filters-with-date-and-time.aspx#zyQCkkICqE6c-MSzxNvGcg
    http://www.kendoui.com/forums/mvc/grid/how-to-implement-a-custom-filter.aspx#2296030

    Thanks.
    Jayesh Goyani
  3. Kendo UI is VS 2017 Ready
  4. Alexander Valchev
    Admin
    Alexander Valchev avatar
    2875 posts

    Posted 01 Apr 2013 Link to this post

    Hello Dana,

    As @Jayesh correctly said, such feature is not supported out of the box. By default DataSource filters the underlying data, if the value of your date field contains time information, it will not be ignored.

    The DataSource provides opportunity for defining a custom filter operator:
    dataSource.filter({ field: "orderId", operator: function(input) {
        //your logic
    }, value: 10428 });

    It would be easier to use this approach with external filter menu. The build-in one does not provide opportunity for customizing the operators like shown above.

    Kind regards,
    Alexander Valchev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top