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

Function classifyDateNote

packages/app-core/src/lib/vault-layout.ts:1061–1085  ·  view source on GitHub ↗
(
  note: Pick<NoteMeta, 'folder' | 'path' | 'title'>,
  settings: VaultSettings | null | undefined
)

Source from the content-addressed store, hash-verified

1059 * day (day-of-month, or ISO week + weekday).
1060 */
1061export 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
1087export interface DateNoteIndexes {
1088 dailyByDate: Map<string, NoteMeta>

Callers 10

store.tsFile · 0.90
CalendarPanelFunction · 0.90
EditorPaneFunction · 0.90
SidebarFunction · 0.90
buildDateNoteIndexesFunction · 0.85
buildDailyNoteDateByPathFunction · 0.85
findDailyNoteForDateFunction · 0.85
findWeeklyNoteForDateFunction · 0.85
findDateNoteByTitleFunction · 0.85

Calls 6

noteFolderSubpathFunction · 0.85
dailyNotePatternsFunction · 0.85
matchDailyPatternFunction · 0.85
weeklyNotePatternsFunction · 0.85
matchWeeklyPatternFunction · 0.85
normalizeVaultSettingsFunction · 0.70

Tested by

no test coverage detected