set.After() works incorrect if timestamp has milliseconds
irlndts opened this issue · 3 comments
irlndts commented
Hello, thank you for your lib, I found it very useful.
I use it on one of my projects and found a small incorrect behaviour (as I can see it).
if I have a rule something like that
rule := rrule.ROption{
Freq: rrule.Frequency(recurrence.Frequency_MINUTELY),
Count: 1,
Bysecond: []int{10, 20, 30, 40, 59},
}
// RRULE:FREQ=MINUTELY;COUNT=1;BYSECOND=10,20,30,40,59
and from-time has milliseconds
from := time.Now() // 2020-07-08 17:43:20.42899 +0300 MSK m=+0.001564527
and the seconds are equal to any of the Bysecond array (20 as in the example)
so set.After() will return nil value
t := set.After(from, true)
// t == nil
I expect an event at 17:43:30.
Works correctly if I truncate milliseconds from the timestamp.
zensh commented
Hi, remove Count option and try it again
irlndts commented
Hi, it helps, yes. But the Count option is infinite now.