(hasWeekdaysSuffix bool)
| 359 | } |
| 360 | |
| 361 | func (p *ScheduleParser) parseDailyBetween(hasWeekdaysSuffix bool) (string, error) { |
| 362 | andIndex, err := p.findDailyBetweenSeparator(hasWeekdaysSuffix) |
| 363 | if err != nil { |
| 364 | return "", err |
| 365 | } |
| 366 | |
| 367 | startTimeStr, err := p.extractTimeBetween(2, andIndex) |
| 368 | if err != nil { |
| 369 | return "", fmt.Errorf("invalid start time in 'between' clause: %w", err) |
| 370 | } |
| 371 | endTimeStr, err := p.extractTimeAfter(andIndex+1, hasWeekdaysSuffix) |
| 372 | if err != nil { |
| 373 | return "", fmt.Errorf("invalid end time in 'between' clause: %w", err) |
| 374 | } |
| 375 | |
| 376 | startMinute, startHour := parseTime(startTimeStr) |
| 377 | endMinute, endHour := parseTime(endTimeStr) |
| 378 | if parseTimeToMinutes(startHour, startMinute) == parseTimeToMinutes(endHour, endMinute) { |
| 379 | return "", errors.New("start and end times cannot be the same in 'between' clause") |
| 380 | } |
| 381 | if hasWeekdaysSuffix { |
| 382 | return fmt.Sprintf("FUZZY:DAILY_BETWEEN_WEEKDAYS:%s:%s:%s:%s * * *", startHour, startMinute, endHour, endMinute), nil |
| 383 | } |
| 384 | return fmt.Sprintf("FUZZY:DAILY_BETWEEN:%s:%s:%s:%s * * *", startHour, startMinute, endHour, endMinute), nil |
| 385 | } |
| 386 | |
| 387 | func (p *ScheduleParser) findDailyBetweenSeparator(hasWeekdaysSuffix bool) (int, error) { |
| 388 | if len(p.tokens) < 5 { |
no test coverage detected