Hello,
I have used great tablesorter library
http://tablesorter.com for my open source project here:
http://home-booking.it-pu.com/en It didn't work for date format dd.mm.yyyy used by many European countries
so I added few lines like this: (on the line 989 where another date formats are parsed)
- // date dd.mm.yyyy:
$.tablesorter.addParser({
id: "eudate",
is: function(s) {
return false;
},
format: function(s,table) {
s = s.replace(/\-/g,"/");
s = s.replace(/(\d{1,2})[\/\.](\d{1,2})[\/\.](\d{4})/, "$3/$2/$1");
return $.tablesorter.formatFloat(new Date(s).getTime());
},
type: "numeric"
});
Then in a html header I put this:
- <script type="text/javascript">
$(function() {
$("#myTable")
.tablesorter({widthFixed: true, widgets: ['zebra'],
dateFormat: 'dd.mm.yyyy',
headers: {0:{sorter:'eudate'}}
})
.tablesorterPager({container: $("#pager")});
});
</script>
It is sorting this date format properly. So, if anyone needs it, this is one way out.
Best regards,
Frank