HangfireIO / HangfireIO/Cronos

GetNext ? issue ?

Open
#81 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
1.2k
Forks
137
Avg merge
5d 11h
Merged PRs (30d)
1

Description

Hi,
may be I am wrong somewhere
but with the following cron, `0 18 16 ? * SUN,MON,TUE,WED,THU,FRI,SAT`

```csharp
// I call it at <00:16:16 22/04/2025>

while (!cancellationToken.IsCancellationRequested)
{
DateTime now = DateTime.UtcNow;
DateTime? nextExecTime;
CronExpression nextExecCron = CronExpression.Parse(treatment.Cron, CronFormat.IncludeSeconds);
nextExecTime = nextExecCron.GetNextOccurrence(now.**AddMinutes**(1));

// I got <00:18:16 22/04/2025>

int delay = (int)(nextExecTime.Value - DateTime.Now).TotalMilliseconds;

//wait for delay

} //while
```

I call it at <00:16:18 TUE> + ONE MINUTE

I got <00:18:16 22/04/2025> ==> SO BACK IN TIME ??
should have <00:18:16 **23**/04/2025>

if i debug and wait for several minutes, i got the same result...

thanks for your help

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.