diff --git a/time/timeutil/constants.go b/time/timeutil/constants.go index c3f9b0ef..1524fb97 100644 --- a/time/timeutil/constants.go +++ b/time/timeutil/constants.go @@ -3,15 +3,19 @@ package timeutil import "time" const ( - Day = 24 * time.Hour - Week = 7 * Day + Day = 24 * time.Hour + Week = 7 * Day + WorkDay = 8 * time.Hour + WorkWeek = 5 * WorkDay + WorkDay996 = 12 * time.Hour + WorkWeek996 = 6 * WorkDay996 - DaysPerWeek = float32(7) HoursPerDay = float32(24) + DaysPerWeek = float32(7) - SecondsPerDay = 24 * 60 * 60 - SecondsPerWeek = 7 * SecondsPerDay - SecondsPerYear = (365 * SecondsPerDay) + (6 * 60 * 60) + DaySeconds = 24 * 60 * 60 + WeekSeconds = 7 * DaySeconds + YearSeconds = (365 * DaySeconds) + (6 * 60 * 60) MonthsEN = `["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]` ) diff --git a/time/timeutil/duration.go b/time/timeutil/duration.go index 18458512..250f42b5 100644 --- a/time/timeutil/duration.go +++ b/time/timeutil/duration.go @@ -45,11 +45,11 @@ func ParseDuration(s string) (time.Duration, error) { return zeroDuration, err } if units == "d" { - s = fmt.Sprintf("%vs", i*SecondsPerDay) + s = fmt.Sprintf("%vs", i*DaySeconds) } else if units == "w" { - s = fmt.Sprintf("%vs", i*SecondsPerWeek) + s = fmt.Sprintf("%vs", i*WeekSeconds) } else if units == "y" { - s = fmt.Sprintf("%vs", i*SecondsPerYear) + s = fmt.Sprintf("%vs", i*YearSeconds) } else { return zeroDuration, errors.New("timeutil.ParseDuration Parse Error") }