month

package
v0.46.0 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2023 License: MIT Imports: 8 Imported by: 14

Documentation

Index

Constants

View Source
const (
	MonthsEnAbbr3 = "Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec"
	MonthsEnFull  = "January,February,March,April,May,June,July,August,September,October,November,December"
)

Variables

View Source
var (
	ErrMonthsFormatInvalid = errors.New("invalid number of month elements")
	ErrMonthNotFound       = errors.New("month not found")
)

Functions

func DayofmonthToEnglish

func DayofmonthToEnglish(i uint16) string

func MonthContinuousIsQuarterStart added in v0.46.0

func MonthContinuousIsQuarterStart(mc uint64) bool

func MonthContinuousIsYearStart added in v0.46.0

func MonthContinuousIsYearStart(mc uint64) bool

func MonthContinuousToTime

func MonthContinuousToTime(mc uint64) time.Time

MonthContinuousToTime converts a continuous month value to a `time.Time` value.

func MonthContinuousToYearMonth

func MonthContinuousToYearMonth(mc uint64) (uint64, uint64)

MonthContinuousToYearMonth converts a continuous month value (e.g. number of months from year 0).

func MonthStart added in v0.46.0

func MonthStart(t time.Time, deltaMonths int) time.Time

MonthStart allows you to add/subtract months resulting in the first day of each month while avoiding Go's `AddDate` normalization where "adding one month to October 31 yields December 1, the normalized form for November 31." Setting `deltaMonths` to 0 indicates the current month.

func Parse added in v0.40.10

func Parse(months []string, value string, insensitive bool) (time.Month, error)

func TimeToMonthContinuous

func TimeToMonthContinuous(t time.Time) uint64

TimeToMonthContinuous converts a `time.Time` value to a continuous month.

func TimesMonthStarts added in v0.46.0

func TimesMonthStarts(times ...time.Time) timeutil.Times

TimesMonthStarts returns time series of months given start and end input times.

func YearMonthBase36

func YearMonthBase36(yyyy, mm uint64) string

func YearMonthBase36Time

func YearMonthBase36Time(t time.Time) string

func YearMonthToMonthContinuous

func YearMonthToMonthContinuous(year, month uint64) uint64

YearMonthToMonthContinuous converts a year and month to a continuous month integer. This is useful when an even even spacing between months is desired, such as with charting x-axis values.

Types

This section is empty.

Jump to

Keyboard shortcuts

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