bradymholt / cRonstrue

JavaScript library that translates Cron expressions into human readable descriptions
http://bradymholt.github.io/cRonstrue/
MIT License
1.28k stars 168 forks source link

Incorrect description for days of week when using # character #260

Closed joao-borges closed 1 year ago

joao-borges commented 1 year ago

Hi,

I was trying the following expression for quartz:

1 0 0 ? * 1#1 *

According to the specification, day of the week should be 1-7. So the above expression should be translated to:

At 12:00:01 AM, on the first Sunday of the month

But since cronstrue is using an array of days to find the text, that is being translated to

At 12:00:01 AM, on the first Monday of the month

And the library is also accepting day of week 0which is not supported. And it's returning null for day of week 7 which should be Saturday.

bradymholt commented 1 year ago

You probably need to set dayOfWeekStartIndexZero option.