datetime

package
v1.0.0-beta.217 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const MAX_SAFE_ITERATION_COUNT = 1_000_000

Variables

This section is empty.

Functions

This section is empty.

Types

type ISODuration

type ISODuration struct {
	period.Period
}

ISODuration is a wrapper around github.com/rickb777/period so we don't depend on it directly.

func Between

func Between(start time.Time, end time.Time) ISODuration

func FromDuration

func FromDuration(d time.Duration) ISODuration

FromDuration creates an IMPRECISE Period from a time.Duration

func MustParse

func MustParse(t *testing.T, s string) ISODuration

func NewPeriod

func NewPeriod(years, months, weeks, days, hours, minutes, seconds int) ISODuration

func (ISODuration) Add

func (ISODuration) DivisibleBy

func (p ISODuration) DivisibleBy(smaller ISODuration) (bool, error)

DivisibleBy returns true if the period is divisible by the smaller period (in hours).

func (*ISODuration) Equal

func (p *ISODuration) Equal(v *ISODuration) bool

Equal returns true if the two periods are equal

func (ISODuration) ISOString

func (p ISODuration) ISOString() ISODurationString

ISOString() returns the ISO8601 string representation of the period

func (*ISODuration) ISOStringPtrOrNil

func (d *ISODuration) ISOStringPtrOrNil() *ISODurationString

ISOStringPtrOrNil() returns the ISO8601 string representation of the period or if Period is nil, returns nil

func (ISODuration) InHours

func (p ISODuration) InHours(daysInMonth int) (alpacadecimal.Decimal, error)

InHours returns the value of the period in hours

func (ISODuration) Normalise

func (p ISODuration) Normalise(exact bool) ISODuration

func (ISODuration) Simplify

func (p ISODuration) Simplify(exact bool) ISODuration

func (ISODuration) Subtract

func (p ISODuration) Subtract(p2 ISODuration) (ISODuration, error)

type ISODurationString

type ISODurationString period.ISOString

func (ISODurationString) Parse

func (i ISODurationString) Parse() (ISODuration, error)

func (*ISODurationString) ParsePtrOrNil

func (i *ISODurationString) ParsePtrOrNil() (*ISODuration, error)

ParsePtrOrNil parses the ISO8601 string representation of the period or if ISOString is nil, returns nil

func (ISODurationString) String

func (i ISODurationString) String() string

Jump to

Keyboard shortcuts

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