Dates not sorting correctly when wrapped in anchor tags (simple test cases included)
Dates not sorting correctly when wrapped in anchor tags (simple test cases included)
I'm having trouble with sorting of dates inside anchor tags. Based on the documentation, I thought that the HTML tags would automatically be removed before parsing/sorting. This seems to be the case for numeric values -- I've had no issues with numeric sorting on the same table.
Here's an example with HTML, sorted incorrectly: http://live.datatables.net/cagebeja/1/
Without HTML, sorted correctly: http://live.datatables.net/pikepono/1/
The date format I'm using parses correctly:
Date.parse("9/23/2014 9:44:44 AM") < Date.parse("9/23/2014 3:46:21 PM")
//true
Note that these are both sorted descending, so they should be ordered with the PM date at the top. Is this feature not supported for dates, or am I doing something wrong?
Answers
I was able to fix the problem pretty easily after reading over the Orthogonal data section by adding the "render" option to columns and returning a sorting value.