dmfs / lib-recur

A recurrence processor for Java
Apache License 2.0
198 stars 47 forks source link

Only the First RecurrenceSet.addException(...) Call's EXDATEs Respected #57

Closed lukehollenback closed 5 years ago

lukehollenback commented 5 years ago

Assume I have a RecurrenceSet object named set and some arbitrary TimeZone object called timeZone.

If I call set.addExceptions("10290128T030720,2019127T030720", timeZone); and then get an iterator over the recurrence set, occurrences at both instances are excluded.

However, if I call set.addExceptions("10290128T030720", timeZone); followed by set.addExceptions("2019127T030720", timeZone); and then get an iterator over the recurrence set, only the first occurrence (at 10290128T030720) is excluded. The second one (at 10290128T030720) is still returned as an occurrence by the iterator.

Is this intended behavior? If so, how would I go about specifying EXDATEs taking place in multiple different time zones?

dmfs commented 5 years ago

Adding multiple exdates should work fine. Looks like your dates are mixed up. Please provide a test case which shows the behavior.

lukehollenback commented 5 years ago

Sure. I don't have permissions to push my branch up to this repo, so see the attached RecurrenceSetTest class. If you want to give me permissions, I can push up the branch so it is easy for you to run the test yourself.

testExDatesSingleAdditionAsStrings() and testExDatesSingleAdditionAsLongs() both pass, but testExDatesMultipleAdditionsAsStrings() and testExDatesMultipleAdditionsAsLongs() both fail.

RecurrenceSetTest.txt

dmfs commented 5 years ago

Thanks. I can reproduce the issue with this code. I'll rewrite the unit test a bit and publish a fix.

lukehollenback commented 5 years ago

For what it's worth, I just updated that class to also test the methods that take longs instead of strings. I figured I'd see if maybe just one of the code paths was working strangely. See my updated post above if interested.

dmfs commented 5 years ago

I've just merged a fix into master, please give it a try. I'll publish this version as 0.11.2.

lukehollenback commented 5 years ago

Your fix seems to work. Thank you! Looking forward to being able to update my dependency to the 0.11.2 version.