mirror of
https://github.com/danieldemus/openhab-core.git
synced 2025-01-25 19:55:48 +01:00
Fix for invalid day of week max check (#1986)
Closes #1813 Signed-off-by: Hilbrand Bouwkamp <hilbrand@h72.nl>
This commit is contained in:
parent
7ce96ac06a
commit
df2013805b
@ -280,11 +280,6 @@ class CronAdjuster implements SchedulerTemporalAdjuster {
|
||||
final String[] increments = sub.split("/");
|
||||
final int[] range = parseRange(cronExpression, chronoField, increments[0], min, max, names);
|
||||
|
||||
if (chronoField == ChronoField.DAY_OF_WEEK) {
|
||||
range[0] = range[0] - 1;
|
||||
range[1] = range[1] - 1;
|
||||
}
|
||||
|
||||
if (increments.length == 2) {
|
||||
// we had a / expression
|
||||
final int increment = parseInt(cronExpression, chronoField, increments[1]);
|
||||
@ -488,7 +483,7 @@ class CronAdjuster implements SchedulerTemporalAdjuster {
|
||||
if (nameIndex == null) {
|
||||
return parseInt(cronExpression, chronoField, name);
|
||||
} else {
|
||||
return min + nameIndex;
|
||||
return min + nameIndex - (chronoField == ChronoField.DAY_OF_WEEK ? 1 : 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -145,6 +145,8 @@ public class CronAdjusterTest {
|
||||
{ JAN_1ST_2015, "0 0 0 ? * SUN", new String[] { "2015-01-04T00:00" } },
|
||||
{ JAN_1ST_2015, "0 0 0 ? * SUN-MON",
|
||||
new String[] { "2015-01-04T00:00", "2015-01-05T00:00", "2015-01-11T00:00" } },
|
||||
{ JAN_1ST_2015, "0 0 0 ? * MON-SUN",
|
||||
new String[] { "2015-01-02T00:00", "2015-01-03T00:00", "2015-01-04T00:00" } },
|
||||
{ JAN_1ST_2000, "14-02/2 * * * * *",
|
||||
new String[] { "2000-01-01T00:00:02", "2000-01-01T00:00:14", "2000-01-01T00:00:16",
|
||||
"2000-01-01T00:00:18" } },
|
||||
|
Loading…
Reference in New Issue
Block a user