func (cr *CronRange) IsWithin(t time.Time) (within bool) {
	cr.checkPrecondition()
	within = false
	searchStart := t.Add(-(cr.duration + 1*time.Second))
	rangeStart := cr.schedule.Next(searchStart)
	rangeEnd := rangeStart.Add(cr.duration)
	if rangeStart.Before(searchStart) {
		return
	}
	within = (rangeStart.Before(t) && rangeEnd.After(t)) || rangeStart.Equal(t) || rangeEnd.Equal(t)
	return
}
IsWithin checks if the given time falls within any time range represented by the expression.

It panics if the CronRange instance is nil or incomplete.
package cronrange
import (
	"time"
)
func (cr *CronRange) checkPrecondition() {
	switch {
	case cr == nil:
		panic("CronRange is nil")
	case cr.duration <= 0:
		panic("duration of CronRange is not positive")
	case cr.schedule == nil:
		panic("schedule of CronRange is nil")
	}
}
func (cr *CronRange) NextOccurrences(t time.Time, count int) (occurs []TimeRange) {
	cr.checkPrecondition()
	if count <= 0 {
		panic("count is not positive")
	}
	for curr, i := t, 0; i < count; i++ {
		next := cr.schedule.Next(curr)
		if next.Before(curr) {
			break
		}
		occur := TimeRange{
			Start: next,
			End:   next.Add(cr.duration),
		}
		occurs = append(occurs, occur)
		curr = next
	}
	return
}