diff --git a/bundles/org.openhab.core/src/main/java/org/openhab/core/internal/scheduler/CronAdjuster.java b/bundles/org.openhab.core/src/main/java/org/openhab/core/internal/scheduler/CronAdjuster.java index b5d7303fa..cd8939887 100644 --- a/bundles/org.openhab.core/src/main/java/org/openhab/core/internal/scheduler/CronAdjuster.java +++ b/bundles/org.openhab.core/src/main/java/org/openhab/core/internal/scheduler/CronAdjuster.java @@ -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); } } diff --git a/bundles/org.openhab.core/src/test/java/org/openhab/core/internal/scheduler/CronAdjusterTest.java b/bundles/org.openhab.core/src/test/java/org/openhab/core/internal/scheduler/CronAdjusterTest.java index 2839a497b..fe55e36d0 100644 --- a/bundles/org.openhab.core/src/test/java/org/openhab/core/internal/scheduler/CronAdjusterTest.java +++ b/bundles/org.openhab.core/src/test/java/org/openhab/core/internal/scheduler/CronAdjusterTest.java @@ -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" } },