evcc-io/util/format_functions.go
2024-12-07 14:28:32 +01:00

18 lines
312 B
Go

package util
import "time"
func timeRound(d time.Duration, round string) time.Duration {
switch round {
case "s", "sec":
return d.Round(time.Second)
case "m", "min":
return d.Round(time.Minute)
default:
return d
}
}
func addDate(ts time.Time, y, m, d int) time.Time {
return ts.AddDate(y, m, d)
}