Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[mainui] CronBuilder puts monday as day 1 #902

Closed
Hilbrand opened this issue Feb 10, 2021 · 3 comments · Fixed by #2630
Closed

[mainui] CronBuilder puts monday as day 1 #902

Hilbrand opened this issue Feb 10, 2021 · 3 comments · Fixed by #2630
Labels
bug Something isn't working main ui Main UI

Comments

@Hilbrand
Copy link
Member

In the main ui the cronbuilder puts day 1 as Monday. However, openHAB-core has Sunday as day 1. This differences probably is caused by the fact that openHAB used the Quartz library in the past, while the rest of the world seems to put Monday as day 1.
See also this discussion: https://community.openhab.org/t/oh3-cron-trigger-1-day-out/ So unless we decide to change this to use Monday as day 1 this is a UI bug.

@Hilbrand Hilbrand added bug Something isn't working main ui Main UI labels Feb 10, 2021
@ghys
Copy link
Member

ghys commented Feb 10, 2021

There are multiple side-effects to this "deviation from the rest of the world":

  1. the cron expression builder is under our control so we can change it
  2. the library translating the expressions to human-readable text is https://github.com/bradymholt/cRonstrue. As it happens (!) it "Supports Quartz Job Scheduler cron expressions" and has an option (phew!)

dayOfWeekStartIndexZero: boolean - Whether to interpret cron expression DOW 1 as Sunday or Monday. (Default: true)

  1. in the schedule page, planned occurrences are computed with a fork of https://github.com/bunkat/later - according to http://bunkat.github.io/later/parsers.html#cron it doesn't seem to support setting the first DOW.
    However, I'm looking forward to Adjusted schedule ui to use the new rest service for rule preview #815 and Added rule rest endpoint and backend operation for rule execution simulation openhab-core#2125 being included which should address the schedule (and other problems too).

@Hilbrand
Copy link
Member Author

We could change the core cron scheduler (I actually did some testing on that). But that means it breaks all existing cronjobs. So this would need to be discussed. Wdyt?

@ghys
Copy link
Member

ghys commented Feb 10, 2021

Note that for 1. above I checked and it actually already puts the unambiguous abbreviations when selecting "Specific day of week".

image

[Btw I seem to remember that the scheduler doesn't support every option here - esp. the last 5 ones, some work but I'm pretty sure "nearest weekday" (1W-5W) doesn't.]

We could change the core cron scheduler (I actually did some testing on that). But that means it breaks all existing cronjobs. So this would need to be discussed

It would break all existing affected cronjobs, not sure if there are that many.
Usually I hate breaking changes and go to lengths to avoid them; but in this case, with a proper heads-up and the fact that:

I think we could afford to introduce one.
But of course it's a decision for @openhab/core-maintainers :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working main ui Main UI
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants