HangfireIO / Cronos

A fully-featured .NET library for working with Cron expressions. Built with time zones in mind and intuitively handles daylight saving time transitions
MIT License
974 stars 114 forks source link

GetOcccurances from and to inclusive does not work #49

Open Simon-Sandrew opened 2 years ago

Simon-Sandrew commented 2 years ago

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!

FaithfulDev commented 7 months ago

@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.