Regular date sort mm/dd/yyyy
Regular date sort mm/dd/yyyy
My url is http://communitychessclub.com/bestgames.php
The date column is mm/dd/yyyy and I need to sort it by year+month+day. I have done a forum "sort date" search and, as I lack a CS degree, it is quite difficult for me to understand. It seems strange that the user (me, an amateur webmaster) is required to do programming to get dates to sort in dataTables, rather than the developer (you, a jquery and js professional). I would have expected date sort to be built-in.
If you solve this problem satisfactorily (so I can understand it) I will contribute financially. I think you deserve it!
The date column is mm/dd/yyyy and I need to sort it by year+month+day. I have done a forum "sort date" search and, as I lack a CS degree, it is quite difficult for me to understand. It seems strange that the user (me, an amateur webmaster) is required to do programming to get dates to sort in dataTables, rather than the developer (you, a jquery and js professional). I would have expected date sort to be built-in.
If you solve this problem satisfactorily (so I can understand it) I will contribute financially. I think you deserve it!
This discussion has been closed.
Replies
Date sorting is indeed built=in to DataTables - anything which Javascript's built in Date.parse() finds as a date will be automatically date sorted. However, there is a limited range of date expressions that will work with Date.parse(). For that there are the sorting plug-ins: http://datatables.net/plug-ins/sorting - which can be customised to any format.
However, looking at your site, the date column does seem to work correctly for me (Safari 5). Is it not sorting correctly for you? What browser are you using - there are some differences between the automatically detected date formatted in the browsers, but I would have thought the standard US date representation would have been picked up by all.
Allan
Please check http://communitychessclub.com/games-nu.php and verify this for yourself.
Allan
Regards,
Allan