Date Sorting when not all rows have valid date
Date Sorting when not all rows have valid date
archie
Posts: 1Questions: 1Answers: 0
Hi, we are using the ultimate date/time sorting plugin and this works fine when we have dates in the column but sometimes we have 'TBC'. When this is the case the date sorting doesn't work. Can anyone provide help on how to resolve this?
Thanks
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
I guess you'd need to modify the code of the plugin a little.
https://datatables.net/plug-ins/sorting/datetime-moment
Looking at the code you might need to change this:
to be like this:
Orthogonal date is another option (set
TBC
to be 0 for the date integer). Or if you want to keep TBC always at the top or bottom of the table this blog post might be of interest.Allan
Yep, as @rf1234 says, you could do that. Another option, and perhaps more future proof if the plugin is updated for any reason, is to just
columns.render
your column so that the sort data returns something that moment already supports, for example:Cheers,
Colin