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

How to control default filter parameter date format?

1 Answer 229 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Scott
Top achievements
Rank 1
Scott asked on 12 Jan 2016, 04:26 PM

I have a grid containing a few date columns.  An example of the json for a data column is as follows:

{
    title: "My Date Field",
    field: "myDate",
    type: "date",
    format: "{0:MM/dd/yyyy hh:mm tt}",
    filterable: { ui: "datetimepicker", format: "MM/dd/yyyy hh:mm" }
}

The column displays in the proper date format (MM/dd/yyyy hh:mm tt) and the filter uses the proper datetimepicker control, which also shows the selected date/time in the proper format (MM/dd/yyyy hh:mm).  The problem is that the filter value in the parameterMap object for the date column is always in this format:

"Tue Jan 12 2016 00:00:00 GMT-0700 (Mountain Standard Time)"

I realize that I could override the parameterMap function in the grid and write code to look up the column type and, if it is a date, convert the filter value to the format that I want, but before I do that I would like to know if there is a way to simply control the default format that the parameterMap uses for the filter value when the filter value comes from a datetimepicker control.  Any info you can provide would be appreciated.  

 

1 Answer, 1 is accepted

Sort by
0
Alexander Popov
Telerik team
answered on 14 Jan 2016, 01:50 PM
Hello Scott,

This behavior is expected, because the DateTimePicker's value is a Date object, hence the format you mentioned. Passing formatted date string is not supported, so if necessary this could be done manually in the parameterMap function.

Regards,
Alexander Popov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Grid
Asked by
Scott
Top achievements
Rank 1
Answers by
Alexander Popov
Telerik team
Share this question
or