atifaziz / NCrontab

Crontab for .NET
Apache License 2.0
913 stars 139 forks source link

GetNextOccurrence() will return the baseTime if the last occrrence is just the same day. #128

Closed Snailya closed 4 months ago

Snailya commented 4 months ago
        var schedule = CrontabSchedule.Parse("0 * 14 * * 5", new CrontabSchedule.ParseOptions(){IncludingSeconds = true});
        var now = new DateTime(2024,7,12,14,23,0);
        var expected = new DateTime(2024,7,19,14,0,0);
        var actual = schedule.GetNextOccurrence(now);
        Assert.That(actual, Is.EqualTo(expected));

Expected: 2024-07-19 14:00:00 But was: 2024-07-12 14:24:00

Snailya commented 4 months ago

I used wrong expression