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 118 forks source link

0 0/3 * 1/1 * ? cannot be parsed #40

Closed AlexandruIstrate closed 3 years ago

AlexandruIstrate commented 3 years ago

I tried using the 0 0/3 * 1/1 * ? Cron expression but it tells me the ? character is unexpected.

I don't understand why it has issues parsing this since I've been using it with Quartz.Net and it works fine.

What is the problem?

Thanks

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/3 * 1/1 * ?", CronFormat.IncludeSeconds);
Console.WriteLine(expression.GetNextOccurrence(DateTime.UtcNow));
AlexandruIstrate commented 3 years ago

Yeah, that makes sense. I did notice my format being different.