reugn/go-quartz

invalid cron expression: fillRange

zhujintao opened this issue · 5 comments

58 0/50 9-2 * * ? invalid cron expression: fillRange

reugn commented

@zhujintao, did you mean to use 58 0/50 2-9 * * ? ?

@zhujintao, did you mean to use 58 0/50 2-9 * * ? ?
no, 9-2 skips the range of 3-8

util.go

func fillRange(from, to int, s ...int) ([]int, error) {

	if to < from {
		min, max := s[0], s[1]
		var arr []int
		for i := min; i <= max; i = i + 1 {
			if i <= to || i >= from {
				arr = append(arr, i)
			}
		}
		return arr, nil
	}
reugn commented

@zhujintao, this type of cron expression is not valid, see here. This can be written as 58 0/50 0-2,9-23 * * ?, but mixed range type is not yet supported.

58 0/50 9-2 * * ? is Quartz cron expression, supported.

reugn commented

58 0/50 0-2,9-23 * * ? can be used with v0.8.0.