This commit is contained in:
shoopea 2019-05-08 23:20:38 +08:00
parent 00a976cd36
commit 307f7e7ddf

10
def.go
View File

@ -63,11 +63,11 @@ const (
func fromChatWarsDate(d string) (t time.Time, err error) { func fromChatWarsDate(d string) (t time.Time, err error) {
r := regexp.MustCompile(`(?P<Day>[0-9]{2}) (?P<Month>(Wintar|Hornung|Lenzin|Ōstar|Winni|Brāh|Hewi|Aran|Witu|Wīndume|Herbist|Hailag)) (?P<Year>[0-9]{4})( (?P<Hour>[0-9]{2}):(?P<Minute>[0-9]{2})){0,1}`) r := regexp.MustCompile(`(?P<Day>[0-9]{2}) (?P<Month>(Wintar|Hornung|Lenzin|Ōstar|Winni|Brāh|Hewi|Aran|Witu|Wīndume|Herbist|Hailag)) (?P<Year>[0-9]{4})( (?P<Hour>[0-9]{2}):(?P<Minute>[0-9]{2})){0,1}`)
if r.FindStringSubmatch(d) != nil { if r.FindStringSubmatch(d) != nil {
log.Printf("fromChatWarsDate : Day : %s\n", r.ReplaceAllString(d, "${Day}"), objId) log.Printf("fromChatWarsDate : Day : %s\n", r.ReplaceAllString(d, "${Day}"))
log.Printf("fromChatWarsDate : Month : %s\n", r.ReplaceAllString(d, "${Month}"), objId) log.Printf("fromChatWarsDate : Month : %s\n", r.ReplaceAllString(d, "${Month}"))
log.Printf("fromChatWarsDate : Year : %s\n", r.ReplaceAllString(d, "${Year}"), objId) log.Printf("fromChatWarsDate : Year : %s\n", r.ReplaceAllString(d, "${Year}"))
log.Printf("fromChatWarsDate : Hour : %s\n", r.ReplaceAllString(d, "${Hour}"), objId) log.Printf("fromChatWarsDate : Hour : %s\n", r.ReplaceAllString(d, "${Hour}"))
log.Printf("fromChatWarsDate : Minute : %s\n", r.ReplaceAllString(d, "${Minute}"), objId) log.Printf("fromChatWarsDate : Minute : %s\n", r.ReplaceAllString(d, "${Minute}"))
return time.Now(), nil return time.Now(), nil
} else { } else {
return time.Now(), errors.New("Wrong format") return time.Now(), errors.New("Wrong format")