Documentation ¶
Index ¶
- Constants
- Variables
- func DT6FormatOrDefault(layout string, dt6 int32, def string) (string, error)
- func DT6sToString(startDT6, endDT6 int32, ...) (string, error)
- func DT6sToStrings(startDT6, endDT6 int32, layout, presentText string) (string, string, error)
- func DayofmonthToEnglish(i uint16) string
- func MonthContinuousIsQuarterStart(mc uint64) bool
- func MonthContinuousIsYearStart(mc uint64) bool
- func MonthContinuousToTime(mc uint64) time.Time
- func MonthContinuousToYearMonth(mc uint64) (uint64, uint64)
- func MonthStart(t time.Time, deltaMonths int) time.Time
- func MustDT6FormatOrDefault(layout string, dt6 int32, def string) string
- func Parse(months []string, value string, insensitive bool) (time.Month, error)
- func StartEndDT6s(dt6s []int32) (int32, int32)
- func TimeToMonthContinuous(t time.Time) uint64
- func TimesMonthStarts(times ...time.Time) timeutil.Times
- func YearMonthBase36(yyyy, mm uint64) string
- func YearMonthBase36Time(t time.Time) string
- func YearMonthToMonthContinuous(year, month uint64) uint64
Constants ¶
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 ¶
var ( ErrMonthsFormatInvalid = errors.New("invalid number of month elements") ErrMonthNotFound = errors.New("month not found") )
Functions ¶
func DT6FormatOrDefault ¶ added in v0.50.0
DT6FormatOrDefault coverts an `int32` to a `layout`, using `def`ault
func DT6sToString ¶ added in v0.50.0
func DT6sToString(startDT6, endDT6 int32, layout, presentText, prefixText, joinText, suffixText string) (string, error)
DT6sToString returns a formatted date range. This function is can be used to generate a string such as: ` (Jan 2007-Dec2008)` with the call `DT6sToString(200701, 200812, "Jan 2006", "Present", " (", "-", ")")` or ` (Jan 2007-Present)` with the call `DT6sToString(200701, 0, "Jan 2006", "Present", " (", "-", ")")`.
func DT6sToStrings ¶ added in v0.50.0
func DayofmonthToEnglish ¶
func MonthContinuousIsQuarterStart ¶ added in v0.46.0
func MonthContinuousIsYearStart ¶ added in v0.46.0
func MonthContinuousToTime ¶
MonthContinuousToTime converts a continuous month value to a `time.Time` value.
func MonthContinuousToYearMonth ¶
MonthContinuousToYearMonth converts a continuous month value (e.g. number of months from year 0).
func MonthStart ¶ added in v0.46.0
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 MustDT6FormatOrDefault ¶ added in v0.50.0
DT6FormatOrDefault coverts an `int32` to a `layout`, using `def`ault. Panics on `time.Parse()` error.
func StartEndDT6s ¶ added in v0.50.0
StartEndDT6s returns a start and end from a range. `-1` is returned if a 0 lenth slice is provided. If only a start date is provided, a `0` is returned to represent "not provided", which can indicate something like "the present".
func TimeToMonthContinuous ¶
TimeToMonthContinuous converts a `time.Time` value to a continuous month.
func TimesMonthStarts ¶ added in v0.46.0
TimesMonthStarts returns time series of months given start and end input times.
func YearMonthBase36 ¶
func YearMonthBase36Time ¶
func YearMonthToMonthContinuous ¶
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.