Skip to content

Commit

Permalink
#41: Fixed bug in date comparison between the comments
Browse files Browse the repository at this point in the history
  • Loading branch information
jjtykkyl committed Feb 24, 2016
1 parent 2483c24 commit 5a0b13a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions js/jquery-comments.js
Original file line number Diff line number Diff line change
Expand Up @@ -620,13 +620,13 @@
}

if(pointsOfB != pointsOfA) {
return pointsOfB - pointsOfA;
return pointsOfB - pointsOfA > 0;

} else {
// Return newer if popularity is the same
var createdA = new Date(commentA.created).getTime();
var createdB = new Date(commentB.created).getTime();
return createdB - createdA;
return createdB - createdA > 0;
}
});

Expand All @@ -636,9 +636,9 @@
var createdA = new Date(commentA.created).getTime();
var createdB = new Date(commentB.created).getTime();
if(sortKey == 'oldest') {
return createdA - createdB;
return createdB - createdA <= 0;
} else {
return createdB - createdA;
return createdB - createdA > 0;
}
});
}
Expand Down

0 comments on commit 5a0b13a

Please sign in to comment.