ui-grid icon indicating copy to clipboard operation
ui-grid copied to clipboard

Sort by Date Bug

Open sonicparke opened this issue 13 years ago • 4 comments

When sorting a column that contains as date as a string like '2/02/2013' it's not sorting by month but by first character then the next. So the sort order is going like this: 1/22/2010 10/17/2010 12/17/2010 2/31/2010

etc.

Here's a plunker: http://plnkr.co/edit/zCkvcO?p=preview

sonicparke avatar Mar 07 '13 15:03 sonicparke

Yes, we removed the date string sorting functions from ng-grid because they were heuristic and unreliable (they were carried over from kogrid). What you can specify is a custom sorting algorithm with the column definition "sortFn" or, instead of using date strings, use date objects and use the cellFilter "date:medium" or "date:short" (I think it's short).

On Thursday, March 7, 2013, Brad McAlister wrote:

When sorting a column that contains as date as a string like '2/02/2013' it's not sorting by month but by first character then the next. So the sort order is going like this: 1/22/2010 10/17/2010 12/17/2010 2/31/2010

etc.

Here's a plunker: http://plnkr.co/edit/zCkvcO?p=preview

— Reply to this email directly or view it on GitHubhttps://github.com/angular-ui/ng-grid/issues/222 .

-Tim Sweet

orneryd avatar Mar 07 '13 17:03 orneryd

AH. OK then. Thanks!

sonicparke avatar Mar 07 '13 18:03 sonicparke

Hey, I got solution for Date column sorting. http://plnkr.co/edit/0VD3X5YvuNSWAZlig95X?p=info

surajvpatil25 avatar Feb 26 '14 09:02 surajvpatil25

@surajvpatil25 its working

NomanChali avatar Mar 16 '17 09:03 NomanChali