This is a migrated thread and some comments may be shown as answers.

Filtering DateTime Column - Neglect Time values

8 Answers 129 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Jatin
Top achievements
Rank 1
Jatin asked on 31 Aug 2011, 01:34 PM
Hi,
   I have a column in Telerik Grid which is of type DateTime. I want to only use the Date part of it for display and filtering. As a result, I used the following code
@(Html.Telerik().Grid<State>()
                .Name("tlkStateGrid")
                .Columns(col => {
                    col.Bound(m => m.CreatedOn).Title("Created On").Format("{0:dd/MM/yyyy}");

The Grid does display the Date (CreatedOn) in the format specified. However, the filtering doesn't work as expected. I think that while filtering, the time values are considered too by the Grid. So if two dates are same but having different time values, they are not considered 'equal'. 
How do I configure grid to neglect the time values and compare only dates, when filtering.

regards,
Nirvan.

8 Answers, 1 is accepted

Sort by
0
Jatin
Top achievements
Rank 1
answered on 31 Aug 2011, 02:12 PM
The demo provided on http://demos.telerik.com/aspnet-mvc/grid doesn't seem to work when filtering by "Order Date". Any ideas how to use filtering only on Date.

regards,
Nirvan.
0
Jatin
Top achievements
Rank 1
answered on 06 Sep 2011, 07:13 AM
Any Help Please
0
Don Cote
Top achievements
Rank 1
answered on 08 Feb 2012, 05:08 PM
I'm looking at filtering by date and time as well.  It would be great to see Telerik respond to these issues.
0
Atul
Top achievements
Rank 1
answered on 18 May 2012, 01:55 PM
I am also waiting for reply from Telerik
0
Zac
Top achievements
Rank 1
answered on 19 May 2012, 10:54 AM
I would also like to see some guidance on this issue. It would seem obvious to have a simple IgnoreTime option for any date columns.
0
Petur Subev
Telerik team
answered on 22 May 2012, 03:55 PM
Hello all,

The only way to change the comparator of the DateTime objects so the time part is neglected you should use custom binding.

All the best,
Petur Subev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now.
0
Zac
Top achievements
Rank 1
answered on 25 Jun 2012, 01:21 PM
Developing a custom binding looks like an awful lot of work for such a simple requirement. I have sent Telerik a feature request for this to be added, and I recommend that others do as well so we can get some help on this.
0
Atul
Top achievements
Rank 1
answered on 25 Jun 2012, 01:30 PM
Hi,

I have done it by updating filter.js. 
I have added hack In Jquery where actually Date filters are being created in filter.js.

To neglect time while date filter I have done following
 1. equal to:  I have added From dd/MM/yyyy 00:00:00  To dd/MM/yyyy 23:59:59
 2. Not equal to:  I have added less then dd/MM/yyyy 00:00:00  OR greater than dd/MM/yyyy 23:59:59 

etc....
 
Tags
Grid
Asked by
Jatin
Top achievements
Rank 1
Answers by
Jatin
Top achievements
Rank 1
Don Cote
Top achievements
Rank 1
Atul
Top achievements
Rank 1
Zac
Top achievements
Rank 1
Petur Subev
Telerik team
Share this question
or