You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
startimer/cron.go

23 lines
389 B
Go

1 year ago
package startimer
import (
"errors"
"strings"
)
func parseCron(cron string) (StarTimer, error) {
for {
oldLen := len(cron)
cron = strings.ReplaceAll(strings.TrimSpace(cron), " ", " ")
if len(cron) == oldLen {
break
}
}
ct := strings.Split(cron, " ")
if len(ct) != 6 {
return StarTimer{}, errors.New("Invalid cron,argument not enough")
}
return StarTimer{}, nil
}