dateutil

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2024 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package dateutil provides interval handling.

Index

Constants

This section is empty.

Variables

View Source
var (
	// EveryMinute will chop up a timespan into 60s intervals;
	// https://english.stackexchange.com/q/3091/222
	EveryMinute = makeIntervalFunc(padLMinute, padRMinute)
	Hourly      = makeIntervalFunc(padLHour, padRHour)
	Daily       = makeIntervalFunc(padLDay, padRDay)
	Weekly      = makeIntervalFunc(padLWeek, padRWeek)
	Biweekly    = makeIntervalFunc(padLBiweek, padRBiweek)
	Monthly     = makeIntervalFunc(padLMonth, padRMonth)
)

Functions

func MustParse

func MustParse(value string) time.Time

MustParse will panic on an unparsable date string.

Types

type Interval

type Interval struct {
	Start time.Time
	End   time.Time
}

Interval groups start and end.

func (Interval) String

func (iv Interval) String() string

String renders an interval.

type IntervalFunc added in v0.1.334

type IntervalFunc func(s, e time.Time) []Interval

IntervalFunc takes a start and endtime and returns a number of intervals. How intervals are generated is flexible.

type PadFunc added in v0.1.334

type PadFunc func(t time.Time) time.Time

PadFunc allows to move a given time back and forth.

Jump to

Keyboard shortcuts

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