448
if part != "*" {
449
if strings.Contains(part, "-") {
450
>
// Only a single dash is allowed to denote a range (e.g. "1-5").
calendar.go
451
>
// Inputs with multiple dashes like "1-5-7" should raise the
452
>
// canonical "too many dashes" error expected by tests.
453
>
if strings.Count(part, "-") > 1 { // no negative numbers are expected in spec
454
return nil, fmt.Errorf("%s has too many dashes", field)
455
}
456
>
rangeParts := strings.SplitN(part, "-", 2)
calendar.go
457
>
if len(rangeParts) != 2 {
458
return nil, fmt.Errorf("%s has too many dashes", field)
459
}
460
>
if start, err = parseValue(rangeParts[0], minVal, maxVal, parseMode); err != nil {
calendar.go
461
return nil, fmt.Errorf("%s Start is not in range [%d-%d]", field, minVal, maxVal)
462
}
463
>
if end, err = parseValue(rangeParts[1], start, maxVal, parseMode); err != nil {
calendar.go
464
return nil, fmt.Errorf("%s End is before Start or not in range [%d-%d]", field, minVal, maxVal)
465
}