Cronos icon indicating copy to clipboard operation
Cronos copied to clipboard

GetOcccurances from and to inclusive does not work

Open Simon-Sandrew opened this issue 2 years ago • 1 comments

Hi!

Could be me misunderstanding something, but im getting different results with the following call:

DateTime startTime = {'5/20/2022 12:00:00 AM' }; //obv as a DateTime object DateTime endTime= {'5/31/2022 12:00:00 AM' }; // obv as a DateTime object string expression = '0 0 9 * * 1,2,3,4,5'; var cron = cronExpression.Parse(expression , CronFormat.IncludeSeconds); cronExpression.GetOccurances(startTime, endTime, true, true). this returns, as expected the following: 5/20/2022 9:00 5/23/2022 9:00 5/24/2022 9:00 5/25/2022 9:00 5/26/2022 9:00 5/27/2022 9:00 5/30/2022 9:00

however, changing the expression to the following string expression = '0 0 0 * * 1,2,3,4,5';

removes 5/20 from the list, despite it being the exact same call?

I could theoretically move the input times back by a second, but that's a hacky fix id rather not do.

Again, not sure if this is expected behavior, or if I'm just being dumb. Let me know if you can help. Thanks!

Simon-Sandrew avatar May 31 '22 18:05 Simon-Sandrew

@Simon-Sandrew Good news, I just tested your issues with the current version and it now works as expected. You didn't mention what version you are using, so I can't verify the original issue. Maybe you could test it again and report back if this issue is resolved for you.

FaithfulDev avatar Dec 04 '23 19:12 FaithfulDev