teambition/rrule-go

After generating a rule from a string, rule.DTStart does not work as expected [has workaround]

Closed this issue · 0 comments

If I have code like:

startTime := /* some time which is not now, including some day which is not today */
rruleString := "FREQ=WEEKLY"
myRule, _ := rrule.StrToRRule(rruleString)
myRule.DTStart(startTime)

Then the initial calculations of day of the week for the rrule to match are wrong, as the calculations done here and in the following lines (which assume using time.Now() is valid) https://github.com/teambition/rrule-go/blob/master/rrule.go#L145 are never re-done.

Workaround
The workaround is to use rrule.StrToROption / rrule.StrToROptionInLocation and then on the resultant options struct, set Dtstart to your start time.