timecalc

package module
v0.0.0-...-971fc30 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2023 License: MIT Imports: 4 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

timecalc

Some helper functions for date calculations in Golang

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AstrologicalSign

type AstrologicalSign struct {
	Name          string
	LocalizedName string
	Symbol        string
}

type DateDiff

type DateDiff struct {
	Years  int
	Months int
	Days   int
}

func GetDateDiff

func GetDateDiff(a, b FullDate) DateDiff

type Duration

type Duration struct {
	Years      int
	Months     int
	Days       int
	IsFinished bool
	Error      error
}

type FullDate

type FullDate struct {
	*time.Time
}

func (FullDate) Age

func (fd FullDate) Age(referenceDate time.Time) DateDiff

Age returns the number of years, months, and days passed at the given reference date since this FullDate.

func (FullDate) AgeYears

func (fd FullDate) AgeYears(referenceDate time.Time) int

AgeYears returns the number of full years passed for the given reference date since this FullDate.

func (FullDate) AstrologicalSign

func (fd FullDate) AstrologicalSign() AstrologicalSign

func (FullDate) InverseAge

func (fd FullDate) InverseAge(referenceDate time.Time) DateDiff

func (FullDate) InverseAgeYears

func (fd FullDate) InverseAgeYears(referenceDate time.Time) int

func (FullDate) NextAnniversary

func (fd FullDate) NextAnniversary(referenceDate time.Time) time.Time

func (FullDate) NextAnniversaryFullDate

func (fd FullDate) NextAnniversaryFullDate(referenceDate time.Time) FullDate

func (FullDate) NextInDays

func (fd FullDate) NextInDays(referenceDate time.Time) int

func (FullDate) WeekdayName

func (fd FullDate) WeekdayName() string

type SparseDate

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

func SparseDateFrom

func SparseDateFrom(date string) *SparseDate

func SparseDateFromLocalized

func SparseDateFromLocalized(input, dateFormat string) *SparseDate

func (*SparseDate) Date

func (sd *SparseDate) Date() FullDate

func (*SparseDate) Format

func (sd *SparseDate) Format(formatString string) string

func (*SparseDate) FormatShort

func (sd *SparseDate) FormatShort(formatString string) string

func (*SparseDate) GetDate

func (sd *SparseDate) GetDate() time.Time

func (*SparseDate) GetDateFormatted

func (sd *SparseDate) GetDateFormatted(format string) string

func (*SparseDate) GetMax

func (sd *SparseDate) GetMax() FullDate

func (*SparseDate) GetMaxDate

func (sd *SparseDate) GetMaxDate() time.Time

func (*SparseDate) GetMin

func (sd *SparseDate) GetMin() FullDate

func (*SparseDate) GetMinDate

func (sd *SparseDate) GetMinDate() time.Time

func (*SparseDate) IsComplete

func (sd *SparseDate) IsComplete() bool

func (*SparseDate) IsCompleteDayAndMonth

func (sd *SparseDate) IsCompleteDayAndMonth() bool

func (*SparseDate) IsCompleteYear

func (sd *SparseDate) IsCompleteYear() bool

func (*SparseDate) IsEmpty

func (sd *SparseDate) IsEmpty() bool

func (SparseDate) MarshalJSON

func (sd SparseDate) MarshalJSON() ([]byte, error)

func (*SparseDate) Parse

func (sd *SparseDate) Parse(input, dateFormat string)

func (*SparseDate) String

func (sd *SparseDate) String() string

func (*SparseDate) Year

func (sd *SparseDate) Year() string

func (*SparseDate) YearInt

func (sd *SparseDate) YearInt() int

Jump to

Keyboard shortcuts

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