datex

package
v1.0.0-beta.192 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package datex is a wrapper around github.com/rickb777/date/v2 and github.com/rickb777/period so we don't depend on it directly.

Index

Constants

View Source
const MAX_SAFE_ITERATION_COUNT = 1_000_000

Variables

This section is empty.

Functions

func PeriodsAlign

func PeriodsAlign(larger Period, smaller Period) (bool, error)

FromDuration creates a Period from a time.Duration

Types

type ISOString

type ISOString period.ISOString

func (ISOString) Parse

func (i ISOString) Parse() (Period, error)

func (*ISOString) ParsePtrOrNil

func (i *ISOString) ParsePtrOrNil() (*Period, error)

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

func (ISOString) String

func (i ISOString) String() string

type Period

type Period struct {
	period.Period
}

func Between

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

func FromDuration

func FromDuration(d time.Duration) Period

FromDuration creates an IMPRECISE Period from a time.Duration

func MustParse

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

func NewPeriod

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

func (Period) Add

func (p Period) Add(p2 Period) (Period, error)

func (*Period) Equal

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

Equal returns true if the two periods are equal

func (Period) ISOString

func (p Period) ISOString() ISOString

ISOString() returns the ISO8601 string representation of the period

func (*Period) ISOStringPtrOrNil

func (d *Period) ISOStringPtrOrNil() *ISOString

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

func (Period) Normalise

func (p Period) Normalise(exact bool) Period

func (Period) Subtract

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

Jump to

Keyboard shortcuts

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