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

Fixed the DayOfWeek handling. #2274

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Fixed the DayOfWeek handling. #2274

wants to merge 1 commit into from

Conversation

zorgoz
Copy link

@zorgoz zorgoz commented Feb 6, 2024

System DOW is 0-6 based, where 0 is always Sunday. Cron DOW is 1-7 based, where Sunday is 7. Hence simply casting to int will yield wrong results.

When calculating next valid timestamp, it is better to start from the larger offset as the current implementation tends to skip over possible values.

Added test cases.

System DOW is 0-6 based, where 0 is always Sunday. Cron DOW is 1-7 based, where Sunday is 7. Hence simply casting to int will yield wrong results.

When calculating next valid timestamp, it is better to start from the larger offset as the current implementation tends to skip over possible values.

Added test cases.
@zorgoz
Copy link
Author

zorgoz commented Feb 6, 2024

Relates to issue: #2273

Copy link

sonarcloud bot commented Feb 6, 2024

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

@daniel-white
Copy link

daniel-white commented Feb 6, 2024

this would be a huge breaking change - its documented as valid for 1-7 - Sun/Sat. https://www.quartz-scheduler.net/documentation/quartz-3.x/tutorial/crontriggers.html

@zorgoz

This comment was marked as outdated.

@zorgoz
Copy link
Author

zorgoz commented Feb 6, 2024

Ah... I see, this package breaks the CRON "standard"... got it....
That makes it incompatible with everything else... :(

@jafin
Copy link
Contributor

jafin commented Feb 18, 2024

@zorgoz this package's cron is consistent with the java quartz version. So I guess there are just variants of cron, UNIX cron and QUARTZ cron (possibly others), each with subtle differences.
I would say this doesn't make it incompatible , it just makes it a variant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants