( note: Pick<NoteMeta, 'folder' | 'path' | 'title'>, settings: VaultSettings | null | undefined )
| 1059 | * day (day-of-month, or ISO week + weekday). |
| 1060 | */ |
| 1061 | export function classifyDateNote( |
| 1062 | note: Pick<NoteMeta, 'folder' | 'path' | 'title'>, |
| 1063 | settings: VaultSettings | null | undefined |
| 1064 | ): DateNoteInfo | null { |
| 1065 | const normalized = normalizeVaultSettings(settings) |
| 1066 | if (note.folder !== 'inbox') return null |
| 1067 | |
| 1068 | const subpath = noteFolderSubpath(note, normalized) |
| 1069 | |
| 1070 | if (normalized.dailyNotes.enabled) { |
| 1071 | for (const pattern of dailyNotePatterns(normalized)) { |
| 1072 | const date = matchDailyPattern(subpath, note.title, normalized, pattern) |
| 1073 | if (date) return { kind: 'daily', date } |
| 1074 | } |
| 1075 | } |
| 1076 | |
| 1077 | if (normalized.weeklyNotes.enabled) { |
| 1078 | for (const pattern of weeklyNotePatterns(normalized)) { |
| 1079 | const date = matchWeeklyPattern(subpath, note.title, normalized, pattern) |
| 1080 | if (date) return { kind: 'weekly', date } |
| 1081 | } |
| 1082 | } |
| 1083 | |
| 1084 | return null |
| 1085 | } |
| 1086 | |
| 1087 | export interface DateNoteIndexes { |
| 1088 | dailyByDate: Map<string, NoteMeta> |
no test coverage detected