From 4053b5cf0a218ad7a11f96a9feb2fdbb340ce45b Mon Sep 17 00:00:00 2001 From: Lost Paul <70213368+LostPaul@users.noreply.github.com> Date: Thu, 6 Jul 2023 15:49:14 +0200 Subject: [PATCH] Fix sort by created/modified --- src/folderOverview.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/folderOverview.ts b/src/folderOverview.ts index 17146e4..d4b7c8f 100644 --- a/src/folderOverview.ts +++ b/src/folderOverview.ts @@ -163,29 +163,29 @@ function sortFiles(files: TAbstractFile[], yaml: yamlSettings, plugin: FolderNot } if (!(a instanceof TFile) || !(b instanceof TFile)) { return -1; } if (yaml.sortBy === 'created') { - if (a.stat.ctime < b.stat.ctime) { - return -1; - } else if (a.stat.ctime > b.stat.ctime) { - return 1; - } - } else if (yaml.sortBy === 'createdAsc') { if (a.stat.ctime > b.stat.ctime) { return -1; } else if (a.stat.ctime < b.stat.ctime) { return 1; } - } else if (yaml.sortBy === 'modified') { - if (a.stat.mtime < b.stat.mtime) { + } else if (yaml.sortBy === 'createdAsc') { + if (a.stat.ctime < b.stat.ctime) { return -1; - } else if (a.stat.mtime > b.stat.mtime) { + } else if (a.stat.ctime > b.stat.ctime) { return 1; } - } else if (yaml.sortBy === 'modifiedAsc') { + } else if (yaml.sortBy === 'modified') { if (a.stat.mtime > b.stat.mtime) { return -1; } else if (a.stat.mtime < b.stat.mtime) { return 1; } + } else if (yaml.sortBy === 'modifiedAsc') { + if (a.stat.mtime < b.stat.mtime) { + return -1; + } else if (a.stat.mtime > b.stat.mtime) { + return 1; + } } // sort by name if (a.name < b.name && yaml.sortBy === 'name') {