Date filter doesn't ignore the time

3 Answers 1851 Views
Top achievements
Rank 1
Dana asked on 28 Mar 2013, 09:45 AM
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?

Top achievements
Rank 1
commented on 21 Jun 2018, 03:28 PM

I have the same problem.

this is my grid and I want to filter only by the date , can you please give me more details how to do it?

                      .Columns(columns =>
                          columns.Bound(c => c.ACHData.ACHID).Title("ACH ID").Width(140);
                          columns.Bound(c => c.TransactionDate).Title("Date").Format("{0: MM/dd/yyyy}").Width(110);
                          columns.Bound(c => c.ACHData.Amount).Title("Amount").Width(120).Format("{0:c}");
                          columns.Bound(c => c.UserName).Title("User Name").Width(130);
                          columns.Bound(c => c.ClearTouchAccountToWorkWith).Title("Cleartouch").Width(140);
                          columns.Bound(c => c.ACHData.ToName).Title("From Name").Width(140);
                          columns.Bound(c => c.TransactionState).Title("Status").Width(140);
                          columns.Bound(c => c.ACHData.Description).Title("Comment").Width(140);
                          //columns.Command(command => { command.Edit().CancelText(" ").UpdateText(" ").Text(" "); }).Width(100);

           //.HtmlAttributes(new { style = "height: 70%;" })

           .Editable(editable => editable.Mode(GridEditMode.InLine))
           .ToolBar(toolbar =>

               toolbar.Custom().HtmlAttributes(new { id = "btn-print" }).Text("PRINT TRANSACTIONS");

           .Excel(excel => excel
                          .ProxyURL(Url.Action("Excel_Export_Save", "Home")))
          .Pageable(pager => pager
                            .PageSizes(new int[] { 6, 15, 20 })
          .Sortable(sortable =>
          .DataSource(dataSource => dataSource
                                   .Model(model =>
                                       model.Id(item => item.ID);
                                       //model.Field(m => m.ACHData.ACHID).Editable(false);
                                   .Read(read => read.Action("GetTransactions", "Transaction"))
                                   /*.Update(update => update.Action("UpdateProduct", "Product"))*/)

           .Selectable(selectable => selectable
           .Events(events => events.Change("OnSelectTransaction"))
           .Pdf(pdf => pdf
                      .Margin("1cm", "1cm", "1cm", "1cm")
                      .ProxyURL(Url.Action("Pdf_Export_Save", "Home")))



3 Answers, 1 is accepted

Sort by
Jayesh Goyani
Top achievements
Rank 2
answered on 29 Mar 2013, 12:10 PM

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

Please try with Custom Filter.

Jayesh Goyani
Alexander Valchev
Telerik team
answered on 01 Apr 2013, 08:55 AM
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!
Alex Hajigeorgieva
Telerik team
answered on 25 Jun 2018, 07:59 AM
Hello, Michael,

To filter only by date, there are few options:

- Create a new field which will have the time as 00:00:00 
- Use the filter event of the grid to modify the filters before they are sent to the server
- Modify the filters on the server

We have a JavaScipt demo which shows the first two of these approaches. Let me know which approach seems to meet your expectations and if you need any assistance with its implementation.

In my opinion, if the time should be ignored, the easiest and cleanest approach would be to use the extra field in the view model and modify the time portion on the server.

Kind Regards,
Alex Hajigeorgieva
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Asked by
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Alexander Valchev
Telerik team
Alex Hajigeorgieva
Telerik team
Share this question