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
974 stars 114 forks source link

GetPreviousOccurrence #67

Open andr3marra opened 3 months ago

andr3marra commented 3 months ago

Hello, I want to know how I can get a Previous Ocurrence from a Cron expression. I tried reading the source code but couldn't understand how it works. The only i could get it is expression.GetOccurence(DateTime.MinValue.ToUniversalTime(), fromUTC).Reverse().Skip(1).First(). Is there a better way to do this? Does this request makes sense to add as a feature? If so what can I read to better my understanding of the algorithm used so I can implement it myself. Ty in advance