Documentation
¶
Overview ¶
Package periodic locates daily, weekly and monthly notes from the vault's directory and title patterns, and formats dates for template variables. Pattern tokens mirror the desktop's vault-layout.ts: yyyy yy MMMM MMM MM M dd d EEEE EEE ww w, with quoted literals.
Index ¶
- func DateOf(kind Kind, subpath, title string, settings vault.VaultSettings, ...) (time.Time, bool)
- func FormatPattern(date time.Time, pattern string, year, week int) string
- func FormatTemplateDate(date time.Time, format string) string
- func ISOWeek(date time.Time) (year, week int)
- func MondayOfISOWeek(weekYear, week int) time.Time
- func RelPathFor(kind Kind, date time.Time, settings vault.VaultSettings, primaryAtRoot bool, ...) string
- type Kind
- type Location
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DateOf ¶
func DateOf(kind Kind, subpath, title string, settings vault.VaultSettings, primaryAtRoot bool) (time.Time, bool)
DateOf recognizes a periodic note from its inbox subpath and title, trying the current pattern and then the legacy ones. Daily returns the day, weekly the Monday of the week, monthly the first of the month.
func FormatPattern ¶
FormatPattern renders a date with a directory or title pattern. year and week override the date's own for weekly notes, which anchor to the ISO week-year.
func FormatTemplateDate ¶
FormatTemplateDate formats a date with a `{{date:FORMAT}}` token string. Both the moment-style (YYYY/DD/dddd) and the date-fns-style (yyyy/dd/EEEE) vocabularies work; `[brackets]` protect literal letters.
func MondayOfISOWeek ¶
MondayOfISOWeek is the Monday (local midnight) of an ISO week.
Types ¶
type Location ¶
Location is where a periodic note lives: its title and its subpath under the inbox bucket.
func LocationFor ¶
func LocationFor(kind Kind, date time.Time, settings vault.VaultSettings, primaryAtRoot bool) Location
LocationFor is where the note for date lives under the current pattern.