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

Function findDailyNoteForDate

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

Source from the content-addressed store, hash-verified

1146}
1147
1148export 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
1172export function findWeeklyNoteForDate(
1173 notes: readonly NoteMeta[],

Callers 1

store.tsFile · 0.90

Calls 5

dailyNoteLocationForDateFunction · 0.85
noteTitleForDateFunction · 0.85
noteFolderSubpathFunction · 0.85
classifyDateNoteFunction · 0.85
normalizeVaultSettingsFunction · 0.70

Tested by

no test coverage detected