MCPcopy Create free account
hub / github.com/ZenNotes/zennotes / findWeeklyNoteForDate

Function findWeeklyNoteForDate

packages/app-core/src/lib/vault-layout.ts:1172–1194  ·  view source on GitHub ↗
(
  notes: readonly NoteMeta[],
  settings: VaultSettings | null | undefined,
  date: Date
)

Source from the content-addressed store, hash-verified

1170}
1171
1172export 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
1196export function findDateNoteByTitle(
1197 notes: readonly NoteMeta[],

Callers 1

store.tsFile · 0.90

Calls 5

weeklyNoteTitleFunction · 0.85
noteFolderSubpathFunction · 0.85
classifyDateNoteFunction · 0.85
normalizeVaultSettingsFunction · 0.70

Tested by

no test coverage detected