Skip to content

Commit

Permalink
Improved fix for #5701
Browse files Browse the repository at this point in the history
Reverts dbd3f83

Fixes #6042
  • Loading branch information
Jermolene committed Sep 19, 2021
1 parent 575c233 commit fb4d77e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions core/modules/wiki.js
Original file line number Diff line number Diff line change
Expand Up @@ -378,12 +378,12 @@ exports.sortTiddlers = function(titles,sortField,isDescending,isCaseSensitive,is
var tiddlerA = self.getTiddler(a),
tiddlerB = self.getTiddler(b);
if(tiddlerA) {
a = tiddlerA.getFieldString(sortField) || "";
a = tiddlerA.fields[sortField] || "";
} else {
a = "";
}
if(tiddlerB) {
b = tiddlerB.getFieldString(sortField) || "";
b = tiddlerB.fields[sortField] || "";
} else {
b = "";
}
Expand All @@ -395,6 +395,8 @@ exports.sortTiddlers = function(titles,sortField,isDescending,isCaseSensitive,is
} else if($tw.utils.isDate(a) && $tw.utils.isDate(b)) {
return isDescending ? b - a : a - b;
} else if(isAlphaNumeric) {
a = String(a);
b = String(b);
return isDescending ? b.localeCompare(a,undefined,{numeric: true,sensitivity: "base"}) : a.localeCompare(b,undefined,{numeric: true,sensitivity: "base"});
} else {
a = String(a);
Expand Down

0 comments on commit fb4d77e

Please sign in to comment.