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
1.01k stars 120 forks source link

Does not accept cron expression #38

Closed qudooschaudhry closed 1 year ago

qudooschaudhry commented 3 years ago

Is this not a valid cron expression?

0 0 11 * 7 SAT

Cronos fails with : 'Unexpected character 'S'.'

qudooschaudhry commented 3 years ago

doesn't take this either

0 0 11 * 7 6

odinserj commented 3 years ago

Please specify CronFormat.IncludeSeconds in the constructor, otherwise it's unclear in general case whether 6th part is about seconds or about years.

var expression = CronExpression.Parse("0 0 11 * 7 SAT", CronFormat.IncludeSeconds);
Console.WriteLine(expression.GetNextOccurrence(DateTime.UtcNow));
qudooschaudhry commented 3 years ago

Thank you that was it.