From fb4d77ef46e23c23f4e46c13f4a529aa29a27dcd Mon Sep 17 00:00:00 2001 From: "jeremy@jermolene.com" Date: Sun, 19 Sep 2021 13:28:58 +0100 Subject: [PATCH] Improved fix for #5701 Reverts dbd3f835bf8399ed1a3da7cc322ec9b6ab783d53 Fixes #6042 --- core/modules/wiki.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/modules/wiki.js b/core/modules/wiki.js index dc9a12aad8b..ce660100ca4 100755 --- a/core/modules/wiki.js +++ b/core/modules/wiki.js @@ -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 = ""; } @@ -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);