Versions in this module Expand all Collapse all v1 v1.0.1 Jan 30, 2026 v1.0.0 Jan 28, 2026 Changes in this version + const OneDay + const OneWeek + var InvalidTimeSegmentErr = errors.New("invalid start/end times. End cannot be before start") + func AddMonths(t time.Time, delta int) time.Time + func AlignTimeWithStepEnd(endTime time.Time, step TimeStep) time.Time + func AlignTimeWithStepStart(startTime time.Time, step TimeStep) time.Time + func AssertAdjacentTimeSegmentsAreNonIntersecting(segments []TimeSegment) error + func AssertAdjacentTimeSegmentsAreNonOverlapping(segments []TimeSegment) error + func AssertTimeSegmentsAreContinuous(segments []TimeSegment) error + func Compare(a time.Time, b time.Time) bool + func Copy(t *time.Time) *time.Time + func ExtractBoundariesFromTimeSegments(timeSegments []TimeSegment, extraBoundaries ...time.Time) ([]time.Time, error) + func FirstDayOfTheMonth(t time.Time) time.Time + func IsZero(a *time.Time) bool + func LastDayOfTheMonth(t time.Time) time.Time + func MustParseTime(format string, s string) time.Time + func PtrCompare(a *time.Time, b *time.Time) bool + func PtrTo(t time.Time) *time.Time + func StartOfTheDay(t time.Time) time.Time + func StartOfTheHour(t time.Time) time.Time + func TimeBetweenExclusive(now time.Time, startTime time.Time, endTime time.Time) bool + func TimeBetweenInclusive(now time.Time, startTime time.Time, endTime time.Time) bool + func TimeIsAlignedWithTimeStep(time time.Time, step TimeStep) bool + func Weekday(t time.Time, weekday time.Weekday) time.Time + func Zero() *time.Time + type StepAlignedTimeSegment struct + func AlignTimesWithTimeStep(startTime time.Time, endTime time.Time, step TimeStep) StepAlignedTimeSegment + type TimeSegment struct + End time.Time + Start time.Time + func MustParseTimeSegment(format string, s string, e string) TimeSegment + func NewTimeSegment(start time.Time, end time.Time) (TimeSegment, error) + func (t TimeSegment) Align(timeStep TimeStep) StepAlignedTimeSegment + func (t TimeSegment) AssertIsComposedOf(subSegments []TimeSegment) error + func (t TimeSegment) Clip(boundary TimeSegment) TimeSegment + func (t TimeSegment) Contains(toTest time.Time, includeEdges bool) bool + func (t TimeSegment) ContainsTimeSegment(other TimeSegment, includeEdges bool) bool + func (t TimeSegment) CountTimeStepBoundaries(timeStep TimeStep) int + func (t TimeSegment) Decompose(boundaries []time.Time, decomposeInto []TimeStep, greedy bool) ([]StepAlignedTimeSegment, error) + func (t TimeSegment) Duration() time.Duration + func (t TimeSegment) ExecuteOncePerBoundary(f func(t time.Time) error, timeStep TimeStep) error + func (t TimeSegment) ExecuteOncePerDuration(function func(t TimeSegment) error, d time.Duration) error + func (t TimeSegment) ExecuteOncePerTimeStep(f func(t TimeSegment) error, timeStep TimeStep) error + func (t TimeSegment) Format(layout string) string + func (t TimeSegment) Intersect(other TimeSegment) (TimeSegment, bool) + func (t TimeSegment) Intersecting(other TimeSegment, includeBoundaries bool) bool + func (t TimeSegment) IsAlignedWithTimeStep(timeStep TimeStep) bool + func (t TimeSegment) IsContainedBy(parent TimeSegment, includeEdges bool) bool + func (t TimeSegment) ListTimeStepBoundaries(timeStep TimeStep) []time.Time + func (t TimeSegment) Overlaps(other TimeSegment, includeEdges bool) bool + func (t TimeSegment) SplitByDuration(d time.Duration) ([]TimeSegment, error) + func (t TimeSegment) SplitByTimeStep(timeStep TimeStep) ([]StepAlignedTimeSegment, error) + func (t TimeSegment) UTC() TimeSegment + type TimeSegmentPair struct + First TimeSegment + Second TimeSegment + func FindAdjacentIntersectingTimeSegments(segments []TimeSegment, includeBoundaries bool) []TimeSegmentPair + func FindDiscontinuities(segments []TimeSegment) []TimeSegmentPair + type TimeStep string + const TimeStepDay + const TimeStepHour + const TimeStepMonth + const TimeStepWeek + func (s TimeStep) Advance(t time.Time, steps int) time.Time