mirror of
https://gitlab.com/MisterBiggs/brain-quartz.git
synced 2025-07-26 08:11:24 +00:00
write my own recent notes sort function
This commit is contained in:
@@ -6,6 +6,18 @@ import { GlobalConfiguration } from "../cfg"
|
||||
|
||||
export type SortFn = (f1: QuartzPluginData, f2: QuartzPluginData) => number
|
||||
|
||||
export function byDate(cfg: GlobalConfiguration): SortFn {
|
||||
return (f1, f2) => {
|
||||
if (f1.dates && f2.dates) {
|
||||
// sort descending
|
||||
return getDate(cfg, f2)!.getTime() - getDate(cfg, f1)!.getTime()
|
||||
} else {
|
||||
// prioritize files with dates
|
||||
return -1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function byDateAndAlphabetical(cfg: GlobalConfiguration): SortFn {
|
||||
return (f1, f2) => {
|
||||
// Sort by date/alphabetical
|
||||
|
Reference in New Issue
Block a user