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

Year Support #3

Closed rfvgyhn closed 7 years ago

rfvgyhn commented 7 years ago

I'm currently evaluating hangfire and need to be able to support a date range when the job should run. I saw in commit 8dc1b11c67367192debb09314f68a44a3ad770e8 that year support was removed since it caused ambiguity with the seconds field so it seems like I would have to place those date checks in the job itself which I'd rather not do. Would it be possible to add year support only if there are 7 fields specified in the cron expression meaning if you want to specify a year, you also have to specify seconds?

odinserj commented 7 years ago

Year support was never implemented, that commit only removes plans to add support for the year field. And we currently don't have plans to implement this, because this feature isn't flexible: it's much better to add effective dateStart and dateEnd for the job system itself, if you want to add limitations for the year.

This feature isn't free, it will greatly complicate the parsing code. I need to be sure there's a real reason for this complication.

rfvgyhn commented 7 years ago

I assumed adding year support would be the simplest path to limiting a job's running date range. Since that's not the case, my particular use case is probably outside the scope of this project. Would your recommendation be to update/implement the hangfire RecurringJob* classes to support this?

odinserj commented 7 years ago

We'll add StartDate/EndDate support for Hangfire, meanwhile you can use additional checks in your target method.

rfvgyhn commented 7 years ago

Roger that. Thanks. Is there a place to see a roadmap or should I just wait for release notes?

odinserj commented 7 years ago

This feature can be easily implemented, so I'll leave it to the community. So you can create a PR when needed :-)