periodic

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 10, 2026 License: MIT Imports: 5 Imported by: 0

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

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

func FormatPattern(date time.Time, pattern string, year, week int) string

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

func FormatTemplateDate(date time.Time, format string) string

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 ISOWeek

func ISOWeek(date time.Time) (year, week int)

ISOWeek is the ISO 8601 week number and week-year.

func MondayOfISOWeek

func MondayOfISOWeek(weekYear, week int) time.Time

MondayOfISOWeek is the Monday (local midnight) of an ISO week.

func RelPathFor

func RelPathFor(kind Kind, date time.Time, settings vault.VaultSettings, primaryAtRoot bool, paths map[string]string) string

RelPathFor is the vault-relative path of the note for date.

Types

type Kind

type Kind string

Kind is daily, weekly or monthly.

const (
	Daily   Kind = "daily"
	Weekly  Kind = "weekly"
	Monthly Kind = "monthly"
)

type Location

type Location struct {
	Title   string
	Subpath string
}

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL