teambition / rrule-go

Go library for working with recurrence rules for calendar dates.
MIT License
310 stars 57 forks source link

Is there anyway to see the `Before` relative to the `DTStart` #54

Closed elliotcourant closed 1 year ago

elliotcourant commented 1 year ago

I'm trying to build something that uses RRule for calculating something going forward. However to do so accurately it needs to do a retroactive calculation from the past.

In the scope of the code I have, DTStart is the previous event it had to calculate for. But I would love to be able to accurately see the event before that?

Is there a way to do this?


I technically can take the DTStart.Next() and then take the time difference between the two and subtract that from DTStart. But for a rule like FREQ=MONTHLY;INTERVAL=1;BYMONTHDAY=15,-1 this is not reliable, because the number of days between recurrences can be different each time.

zensh commented 1 year ago

No, because calculating is start from DTStart.