0

The Issue I am seeing is that not all the data is being sorted correctly in this instance it looks like it is ignoring the AM / PM and is sorting strictly off the numerical value of the hours minutes and seconds. I have also attached a snippet of code below is there something I need to do differently or is this possibly a Kendo UI bug

Image displaying date issue

{
  title : "Start Date",
  field : "startDate",
  width : 150,
  template : "#= (startDate==null? '': kendo.toString(new Date(startDate),'MM/dd/yyyy hh:mm tt')) #",
  format : "{0: MM/dd/yyyy hh:mm tt}",
  filterable : {
                 ui : "datetimepicker"
               }
},
{
  title : "Error Date",
  field : "errorDate",
  width : 150,
  template : "#= (errorDate==null? '': kendo.toString(new Date(errorDate),'MM/dd/yyyy hh:mm tt')) #",
  format : "{0: MM/dd/yyyy hh:mm tt}",
  filterable : {
               ui : "datetimepicker"
               }
}

1 Answers1

0

The Kendo UI DataSource widget performs filtering and sorting over the actual values that exist in the data (i.e. not over the data's visual representation in the Grid cells).

The provided screenshot and code suggest that startDate and errorDate are not actual JavaScript Dates, otherwise there would be no need to call new Date() for them.

If these field values are not true Date objects, then they cannot be sorted as such and are probably currently sorted as strings.

The following thread provides more information on how to ensure that the DataSource holds actual JavaScript Date objects.

Why kendo Ui -grid date is not sorting properly?

Community
  • 1
  • 1
dimodi
  • 3,969
  • 1
  • 13
  • 23