User tests: Successful: Unsuccessful:
Fixes #47647
This PR fixes incorrect normalization of the days_of_week field in the Scheduler cron expression.
The UI provides day-of-week values in the range 1–7, but the normalization logic compares against an incorrect range. Because of this mismatch, when all weekdays are selected, the system fails to convert them into a wildcard (*) and instead stores a full list (1,2,3,4,5,6,7).
Due to POSIX cron semantics (OR condition between day-of-month and day-of-week), this causes tasks to run daily instead of only on the 1st of the month.
Updated normalization logic to use:
range(1, 7)
so that selecting all weekdays correctly results in *.
Cron expression stored internally as:
0 9 1 * 1,2,3,4,5,6,7
Because both DOM and DOW are restricted, POSIX OR semantics apply
Task runs daily at 09:00
Example:
Next Execution: 2026-04-29 09:00
Cron expression correctly normalized to:
0 9 1 * *
Day-of-week is treated as wildcard (*)
Task runs only on the 1st of each month at 09:00
Example:
Next Execution: 2026-05-01 09:00
![Before Screenshot]
![After Screenshot/Video]
| Status | New | ⇒ | Pending |
| Category | ⇒ | Administration |
| Title |
|
||||||
the syntax should follow the syntax for linux cron and nothing else
| Labels |
Added:
PR-6.1-dev
|
||
I've updated the implementation to normalize day-of-week values by mapping 7 → 0 before comparison.
This ensures that both representations (0–6 and 1–7) are handled correctly and wildcard detection works as expected while keeping Sunday portable.
Please let me know if you'd prefer this logic to be integrated into wildcardIfMatch instead.
I have tested this item ✅ successfully on a39b118
After applying the patch and saving the task again the cron expression stored as {"type":"cron-expression","exp":"0 9 1 * *"}
I have tested this item ✅ successfully on a39b118
After applying the patch and saving the task again the cron expression stored as {"type":"cron-expression","exp":"0 9 1 * *"}
I have tested this item ✅ successfully on a39b118
Looked into table scheduler_tasks and have seen both result
I have tested this item ✅ successfully on a39b118
Looked into table scheduler_tasks and have seen both result
Not setting RTC (ready to commit) despite of the 2 successful human tests because
| Labels |
Added:
Updates Requested
|
||
According to the description of the linked issue it happens also with 5.4. if that is the case, this PR should be made for the 5.4-dev branch.