Documentation
¶
Index ¶
Constants ¶
View Source
const MAX_SAFE_ITERATIONS = 10000
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Period ¶
func (Period) ContainsExclusive ¶
Exclusive at both start and end
func (Period) ContainsInclusive ¶
Inclusive at both start and end
func (Period) Overlaps ¶
Returns true if the two periods overlap at any point Returns false if the periods are exactly sequential, e.g.: [1, 2] and [2, 3]
func (Period) OverlapsInclusive ¶
Returns true if the two periods overlap at any point Returns true if the periods are exactly sequential, e.g.: [1, 2] and [2, 3]
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 FromISODuration ¶
func (Recurrence) GetPeriodAt ¶
func (r Recurrence) GetPeriodAt(t time.Time) (Period, error)
Returns a period where p.ContainsInclusive(t) is true
func (Recurrence) NextAfter ¶
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) PrevBefore ¶
PrevBefore returns the previous time before t that the recurrence should occur.
type RecurrenceInterval ¶
var ( RecurrencePeriodDaily RecurrenceInterval = RecurrenceInterval{isodate.NewPeriod(0, 0, 0, 1, 0, 0, 0)} RecurrencePeriodWeek RecurrenceInterval = RecurrenceInterval{isodate.NewPeriod(0, 0, 1, 0, 0, 0, 0)} RecurrencePeriodMonth RecurrenceInterval = RecurrenceInterval{isodate.NewPeriod(0, 1, 0, 0, 0, 0, 0)} RecurrencePeriodYear RecurrenceInterval = RecurrenceInterval{isodate.NewPeriod(1, 0, 0, 0, 0, 0, 0)} )
type SimpleTimeline ¶
func NewSimpleTimeline ¶
func NewSimpleTimeline(times []time.Time) SimpleTimeline
type Timeline ¶
type Timeline[T any] struct { // contains filtered or unexported fields }
func NewTimeline ¶
func (Timeline[T]) GetBoundingPeriod ¶
func (Timeline[T]) GetPeriods ¶
Click to show internal directories.
Click to hide internal directories.