isodate

package
v1.0.0-beta.214 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2025 License: Apache-2.0 Imports: 7 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

This section is empty.

Types

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) DivisibleBy

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

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

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() String

ISOString() returns the ISO8601 string representation of the period

func (*Period) ISOStringPtrOrNil

func (d *Period) ISOStringPtrOrNil() *String

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

func (Period) InHours

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

InHours returns the value of the period in hours

func (Period) Normalise

func (p Period) Normalise(exact bool) Period

func (Period) Simplify

func (p Period) Simplify(exact bool) Period

func (Period) Subtract

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

type String

type String period.ISOString

func (String) Parse

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

func (*String) ParsePtrOrNil

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

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

func (String) String

func (i String) String() string

Jump to

Keyboard shortcuts

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