timequery

package
v0.1.12 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LanguageEnglish = "en"
	LanguageChinese = "zh"
)
View Source
const (
	PresetToday      = "today"
	PresetYesterday  = "yesterday"
	PresetLast7Days  = "last-7d"
	PresetLast30Days = "last-30d"
	PresetThisWeek   = "this-week"
	PresetLastWeek   = "last-week"
	PresetThisMonth  = "this-month"
	PresetLastMonth  = "last-month"
	PresetThisYear   = "this-year"
	PresetLastYear   = "last-year"
)

Variables

This section is empty.

Functions

func HasValue

func HasValue(spec Spec) bool

func NormalizeLanguage

func NormalizeLanguage(language string) string

Types

type Kind

type Kind string
const (
	KindPreset    Kind = "preset"
	KindSingleDay Kind = "single_day"
	KindRange     Kind = "range"
)

type Spec

type Spec struct {
	Kind   Kind   `json:"kind,omitempty"`
	Period string `json:"period,omitempty"`
	On     string `json:"on,omitempty"`
	From   string `json:"from,omitempty"`
	To     string `json:"to,omitempty"`
}

func DefaultSpec

func DefaultSpec() Spec

type Window

type Window struct {
	Start time.Time
	End   time.Time
	Label string
	Kind  Kind
}

func Resolve

func Resolve(spec Spec, loc *time.Location, now time.Time) (Window, error)

func ResolveWithLanguage

func ResolveWithLanguage(spec Spec, loc *time.Location, now time.Time, language string) (Window, error)

Jump to

Keyboard shortcuts

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