package tools import ( "time" ) func DifferenceInMonth(t1, t2 time.Time) int { var differYear, differMonth int differYear = t1.Year() - t2.Year() differMonth = int(t1.Month() - t2.Month()) return differYear*12 + differMonth } func IsNextMonth(origin, t time.Time) bool { return DifferenceInMonth(t, origin) == 1 }