File tree Expand file tree Collapse file tree
main/java/com/cronutils/model/definition
test/java/com/cronutils/validator Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -258,10 +258,10 @@ private static CronDefinition cron4j() {
258258 */
259259 private static CronDefinition quartz () {
260260 return CronDefinitionBuilder .defineCron ()
261- .withSeconds ().withStrictRange (). and ()
262- .withMinutes ().withStrictRange (). and ()
263- .withHours ().withStrictRange (). and ()
264- .withDayOfMonth ().withValidRange (1 , 32 ).supportsL ().supportsW ().supportsLW ().supportsQuestionMark ().withStrictRange (). and ()
261+ .withSeconds ().and ()
262+ .withMinutes ().and ()
263+ .withHours ().and ()
264+ .withDayOfMonth ().withValidRange (1 , 32 ).supportsL ().supportsW ().supportsLW ().supportsQuestionMark ().and ()
265265 .withMonth ().withValidRange (1 , 13 ).and ()
266266 .withDayOfWeek ().withValidRange (1 , 7 ).withMondayDoWValue (2 ).supportsHash ().supportsL ().supportsQuestionMark ().and ()
267267 .withYear ().withValidRange (1970 , 2099 ).withStrictRange ().optional ().and ()
Original file line number Diff line number Diff line change @@ -85,4 +85,19 @@ public void testQuestionMarkSupport() {
8585 parser .parse ("0 0 12 ? * FRI-SAT" );
8686 parser .parse ("0 0 12 ? * SAT-SUN" );
8787 }
88+
89+ /**
90+ * Issue #396: overflow ranges
91+ * Quartz cron expressions should support overflowing ranges
92+ * See https://github.com/quartz-scheduler/quartz/blob/master/quartz-core/src/main/java/org/quartz/CronExpression.java
93+ */
94+ @ Test
95+ public void testOverflowRange () {
96+ parser .parse ("20-10 0 0 ? * 3" ); // second overflow
97+ parser .parse ("0 40-20 0 ? * 3" ); // minute overflow
98+ parser .parse ("0 0 12-2 ? * 3" ); // hour overflow
99+ parser .parse ("0 0 0 24-7 * ?" ); // day of month overflow
100+ parser .parse ("0 0 0 ? 10-3 3" ); // month overflow
101+ parser .parse ("0 0 0 ? * 5-1" ); // day of week overflow
102+ }
88103}
You can’t perform that action at this time.
0 commit comments