recurrence

package
v1.0.0-beta.150 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Period

type Period struct {
	From time.Time `json:"from"`
	To   time.Time `json:"to"`
}

func (Period) Contains

func (p Period) Contains(t time.Time) bool

Inclusive at both start and end

func (Period) Duration

func (p Period) Duration() time.Duration

type Recurrence

type Recurrence struct {
	Interval RecurrenceInterval `json:"period"`
	// Anchor can be an arbitrary anchor time for the recurrence.
	// It does not have to be the last or the next time.
	Anchor time.Time `json:"anchor"`
}

func (Recurrence) Next

func (r Recurrence) Next(t time.Time) (time.Time, error)

func (Recurrence) NextAfter

func (r Recurrence) NextAfter(t time.Time) (time.Time, error)

NextAfter returns the next time after t that the recurrence should occur. If at t the recurrence should occur, it will return t.

func (Recurrence) Prev

func (r Recurrence) Prev(t time.Time) (time.Time, error)

func (Recurrence) PrevBefore

func (r Recurrence) PrevBefore(t time.Time) (time.Time, error)

PrevBefore returns the previous time before t that the recurrence should occur.

type RecurrenceInterval

type RecurrenceInterval string
const (
	RecurrencePeriodDaily RecurrenceInterval = "DAY"
	RecurrencePeriodWeek  RecurrenceInterval = "WEEK"
	RecurrencePeriodMonth RecurrenceInterval = "MONTH"
	RecurrencePeriodYear  RecurrenceInterval = "YEAR"
)

func (RecurrenceInterval) IsValid

func (rp RecurrenceInterval) IsValid() bool

func (RecurrenceInterval) Values

func (RecurrenceInterval) Values() (kinds []string)

Jump to

Keyboard shortcuts

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