Closed Chazzzzzzz closed 2 years ago
@Chazzzzzzz, thank you for rising this question and example. The Quartz cron definition requires us to consider only intervals up to 2099. Please see this web page documenting the constraint. We are closing this issue as the cron parser is behaving as expected.
Hey guys, we find an issue in latest cron-utils release: ExecutionTime.nextExecution will return Empty when time is beyond 2099 years. The following is my test code
In the test class, I use 12/31/2099 as the current time and try to find next execution time after one month. The result I get is empty. Please check and let me know if I am doing a wrong way or its a bug of the library.
class app `
import static com.cronutils.model.CronType.QUARTZ; import static com.cronutils.model.definition.CronDefinitionBuilder.instanceDefinitionFor;
import java.time.ZonedDateTime; import java.util.Optional;
import com.cronutils.model.Cron; import com.cronutils.model.time.ExecutionTime; import com.cronutils.parser.CronParser;
public class app { private static final String CRON_START = "cron("; private static final int CRON_OFFSET = CRON_START.length(); private static final CronParser CRON_PARSER = new CronParser(instanceDefinitionFor(QUARTZ));
} `
test class `
import static org.junit.Assert.assertEquals;
import java.time.ZoneId; import java.time.ZonedDateTime; import java.util.Optional;
import org.junit.Test;
public class test_app {
} `