This commit is contained in:
@@ -184,3 +184,10 @@ func AddYears(t time.Time, yearCount float64, tz *time.Location) time.Time {
|
||||
|
||||
return t.Add(time.Duration(float64(t1.Sub(t0)) * floatCount))
|
||||
}
|
||||
|
||||
func DaysInMonth(t time.Time) int {
|
||||
// https://stackoverflow.com/a/73882035/1761622
|
||||
|
||||
y, m, _ := t.Date()
|
||||
return time.Date(y, m+1, 0, 0, 0, 0, 0, time.UTC).Day()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user