Fix sort by created/modified

This commit is contained in:
Lost Paul 2023-07-06 15:49:14 +02:00
parent 4cddc2a04f
commit 4053b5cf0a

View file

@ -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') {