Support SUN as minimum of range in CronExpression

This commit makes sure that SUN can be used at the beginning of a range,
 like SUN-FRI.

Closes gh-26598
This commit is contained in:
Arjen Poutsma
2021-02-25 10:50:34 +01:00
parent a9240e0bac
commit eb68e6a62a
3 changed files with 26 additions and 0 deletions

View File

@@ -165,6 +165,10 @@ final class BitsCronField extends CronField {
int max = Integer.parseInt(value.substring(hyphenPos + 1));
min = type.checkValidValue(min);
max = type.checkValidValue(max);
if (type == Type.DAY_OF_WEEK && min == 7) {
// If used as a minimum in a range, Sunday means 0 (not 7)
min = 0;
}
return ValueRange.of(min, max);
}
}