( notes: readonly NoteMeta[], settings: VaultSettings | null | undefined, date: Date )
| 1170 | } |
| 1171 | |
| 1172 | export function findWeeklyNoteForDate( |
| 1173 | notes: readonly NoteMeta[], |
| 1174 | settings: VaultSettings | null | undefined, |
| 1175 | date: Date |
| 1176 | ): NoteMeta | null { |
| 1177 | const expected = weeklyNoteLocationForDate(date, settings) |
| 1178 | const normalized = normalizeVaultSettings(settings) |
| 1179 | const weekKey = weeklyNoteTitle(date) |
| 1180 | return ( |
| 1181 | notes.find( |
| 1182 | (note) => |
| 1183 | note.folder === 'inbox' && |
| 1184 | note.title === expected.title && |
| 1185 | noteFolderSubpath(note, normalized) === expected.subpath && |
| 1186 | classifyDateNote(note, normalized)?.kind === 'weekly' |
| 1187 | ) ?? |
| 1188 | notes.find((note) => { |
| 1189 | const info = classifyDateNote(note, normalized) |
| 1190 | return info?.kind === 'weekly' && weeklyNoteTitle(info.date) === weekKey |
| 1191 | }) ?? |
| 1192 | null |
| 1193 | ) |
| 1194 | } |
| 1195 | |
| 1196 | export function findDateNoteByTitle( |
| 1197 | notes: readonly NoteMeta[], |
no test coverage detected