- func EndOfMonth(t time.Time) time.Time
- func GetMostRecentContiguousMonths(startTimes time.Time) time.Time
- func InRange(t, start, end time.Time) bool
- func IsCurrentMonth(t, compare time.Time) bool
- func IsMonthStart(t time.Time) bool
- func IsPreviousMonth(t, toCompare time.Time) bool
- func MonthsPreviousTo(months int, now time.Time) time.Time
- func ParseTimeFromPath(path string) (time.Time, error)
- func StartOfMonth(t time.Time) time.Time
- func StartOfNextMonth(t time.Time) time.Time
- func StartOfPreviousMonth(t time.Time) time.Time
GetMostRecentContinuousMonths finds the start time of the most recent set of continguous months.
For example, if the most recent start time is Aug 15, then that range is just 1 month If the recent start times are Aug 1 and July 1 and June 15, then that range is three months and we return June 15.
note: return slice will be nil if :startTimes: is nil :startTimes: must be sorted in decreasing order (see unit test for examples)
func IsCurrentMonth ¶
IsCurrentMonth checks if :t: is in the current month, as defined by :compare: generally, pass in time.Now().UTC() as :compare:
func IsMonthStart ¶
IsMonthStart checks if :t: is the start of the month
func IsPreviousMonth ¶
IsPreviousMonth checks if :t: is in the month directly before :toCompare:
func MonthsPreviousTo ¶
Compute the N-month period before the given date. For example, if it is currently April 2020, then 12 months is April 2019 through March 2020.
func ParseTimeFromPath ¶
ParseTimeFromPath returns a UTC time from a path of the form '<timestamp>/', where <timestamp> is a Unix timestamp