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

Function weeklyNoteLocationForPattern

packages/app-core/src/lib/vault-layout.ts:927–952  ·  view source on GitHub ↗
(
  date: Date,
  settings: VaultSettings,
  pattern: DateNotePatternSettings
)

Source from the content-addressed store, hash-verified

925}
926
927function weeklyNoteLocationForPattern(
928 date: Date,
929 settings: VaultSettings,
930 pattern: DateNotePatternSettings
931): WeeklyNoteLocation {
932 const weekYear = getISOWeekYear(date)
933 const week = getISOWeek(date)
934 const monday = mondayOfISOWeek(weekYear, week)
935 const locale = pattern.locale ?? DEFAULT_WEEKLY_NOTE_LOCALE
936 const patternParts = { year: weekYear, week }
937 const subpath = normalizePrimaryRelativeSubpath(
938 normalizeWeeklyNotesDirectory(
939 formatDirectoryPattern(monday, pattern.directory, locale, patternParts)
940 ),
941 settings
942 )
943 const title = normalizeWeeklyNoteTitlePattern(
944 formatDateNotePattern(
945 monday,
946 pattern.titlePattern ?? DEFAULT_WEEKLY_NOTE_TITLE_PATTERN,
947 locale,
948 patternParts
949 )
950 )
951 return { title, subpath }
952}
953
954/**
955 * Numerics a note's directory + title expose, used only to bound the set of

Callers 2

matchWeeklyPatternFunction · 0.85

Calls 8

getISOWeekYearFunction · 0.90
getISOWeekFunction · 0.90
mondayOfISOWeekFunction · 0.90
formatDirectoryPatternFunction · 0.85
formatDateNotePatternFunction · 0.85

Tested by

no test coverage detected