kcron-common icon indicating copy to clipboard operation
kcron-common copied to clipboard

Every expression doesn't work and is not present

Open ebelevics opened this issue 1 year ago • 4 comments

https://crontab.guru/#0_0_/2__*

Cron.parseAndBuild("0 0 */2 * *")

crashes. Is and will step values be added to this library

ebelevics avatar Sep 16 '24 04:09 ebelevics

Hello @ebelevics! Does * equal to 1 in this case?

Scogun avatar Sep 16 '24 09:09 Scogun

What do you mean? For context I haven't used cron beforehand, so am new in this. What I wanted is to set recurrence every 2nd day, or 3rd day, regarding to users choice. Here is error what I get when parsing.

image

ebelevics avatar Sep 16 '24 15:09 ebelevics

Cron.parseAndBuild("0 0 1/2 * *") while I did try this, and it did react as every day. Upon reaching next month it started again with 1. Meaning I had date 29.01.2024, 31.01.2024, 01.02.2024, 03.02.2024, which is not exactly every 2nd day

ebelevics avatar Sep 16 '24 15:09 ebelevics

So, if you need every second day, you should specify not day of month then. Based on this generator it is correct this expression means every second day of month:

Tue Oct 29 2024 01:00:00 GMT+0100
Thu Oct 31 2024 01:00:00 GMT+0100
Fri Nov 01 2024 01:00:00 GMT+0100
Sun Nov 03 2024 01:00:00 GMT+0100

Scogun avatar Sep 16 '24 18:09 Scogun