mirror of
https://github.com/lostpaul/obsidian-folder-notes.git
synced 2026-07-22 07:40:24 +00:00
Fix sort by created/modified
This commit is contained in:
parent
4cddc2a04f
commit
4053b5cf0a
1 changed files with 10 additions and 10 deletions
|
|
@ -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') {
|
||||
|
|
|
|||
Loading…
Reference in a new issue