( notes: readonly NoteMeta[], settings: VaultSettings | null | undefined, date: Date )
| 1146 | } |
| 1147 | |
| 1148 | export function findDailyNoteForDate( |
| 1149 | notes: readonly NoteMeta[], |
| 1150 | settings: VaultSettings | null | undefined, |
| 1151 | date: Date |
| 1152 | ): NoteMeta | null { |
| 1153 | const expected = dailyNoteLocationForDate(date, settings) |
| 1154 | const normalized = normalizeVaultSettings(settings) |
| 1155 | const dateKey = noteTitleForDate(date) |
| 1156 | return ( |
| 1157 | notes.find( |
| 1158 | (note) => |
| 1159 | note.folder === 'inbox' && |
| 1160 | note.title === expected.title && |
| 1161 | noteFolderSubpath(note, normalized) === expected.subpath && |
| 1162 | classifyDateNote(note, normalized)?.kind === 'daily' |
| 1163 | ) ?? |
| 1164 | notes.find((note) => { |
| 1165 | const info = classifyDateNote(note, normalized) |
| 1166 | return info?.kind === 'daily' && noteTitleForDate(info.date) === dateKey |
| 1167 | }) ?? |
| 1168 | null |
| 1169 | ) |
| 1170 | } |
| 1171 | |
| 1172 | export function findWeeklyNoteForDate( |
| 1173 | notes: readonly NoteMeta[], |
no test coverage detected