periodic

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2026 License: MIT Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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 FormatPatternLocale added in v0.5.0

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

FormatPatternLocale renders named tokens using the portable locale.

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 FormatTemplateDateLocale added in v0.5.0

func FormatTemplateDateLocale(date time.Time, format, locale string) string

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.

Directories

Path Synopsis
cmd
localedata command
Command localedata prints the CLDR language tags used to generate date names.
Command localedata prints the CLDR language tags used to generate date names.

Jump to

Keyboard shortcuts

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