Skip to content

Commit

Permalink
Fix date sorting
Browse files Browse the repository at this point in the history
The search allowed for years using 2 or 4 digits, while the sorting considered only 2. The reformatting is in ISO format.
  • Loading branch information
sabas committed Jul 26, 2018
1 parent 52c42a9 commit 738958f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/sorts/tablesort.date.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
(function(){
var parseDate = function(date) {
date = date.replace(/\-/g, '/');
date = date.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{2})/, '$1/$2/$3'); // format before getTime
date = date.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{2,4})/, '$3-$2-$1'); // format before getTime

return new Date(date).getTime() || -1;
};
Expand Down

0 comments on commit 738958f

Please sign in to comment.