This commit is contained in:
shoopea 2019-05-09 11:06:36 +08:00
parent a80127fdc5
commit 0139b9644d

8
def.go
View File

@ -119,10 +119,10 @@ func fromChatWarsDate(d string) (t time.Time, err error) {
days++ days++
} }
t, _ := time.Parse(time.RFC3339, "2018-01-31T00:00:00+00:00") t, _ := time.Parse(time.RFC3339, "2018-01-31T00:00:00+00:00")
t = t.Add((days / 3) * time.Day()) t = t.AddDate(0, 0, (days / 3))
t = t.Add((days % 3) * 8 * time.Hour()) t = t.Add((days % 3) * 8 * time.Hour)
t = t.Add(strconv.Atoi(r.ReplaceAllString(d, "${Hour}")) * 20 * time.Minute()) t = t.Add(strconv.Atoi(r.ReplaceAllString(d, "${Hour}")) * 20 * time.Minute)
t = t.Add(strconv.Atoi(r.ReplaceAllString(d, "${Minute}")) * 20 * time.Second()) t = t.Add(strconv.Atoi(r.ReplaceAllString(d, "${Minute}")) * 20 * time.Second)
return t, nil return t, nil
} else { } else {
return time.Now(), errors.New("Wrong format") return time.Now(), errors.New("Wrong format")