duration

package
v0.14.1 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const NumberOfDaysInWeek = 7

Variables

This section is empty.

Functions

func CountFrom

func CountFrom(c string) (int, error)

func Validate

func Validate(str string) error

Types

type Duration

type Duration struct {
	// contains filtered or unexported fields
}

func From

func From(str string) (Duration, error)

func NewDuration

func NewDuration(count int, unit Unit) Duration

func (Duration) AddFrom added in v0.12.0

func (d Duration) AddFrom(t time.Time) time.Time

func (Duration) GetCount

func (d Duration) GetCount() int

func (Duration) GetUnit

func (d Duration) GetUnit() Unit

func (Duration) SubtractFrom

func (d Duration) SubtractFrom(t time.Time) time.Time

type Unit

type Unit string
const (
	None  Unit = "None"
	Hour  Unit = "h"
	Day   Unit = "d"
	Week  Unit = "w"
	Month Unit = "M"
	Year  Unit = "y"
)

func UnitFrom

func UnitFrom(u string) (Unit, error)

Jump to

Keyboard shortcuts

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