-
Notifications
You must be signed in to change notification settings - Fork 138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix recurrence iteration where there is a negative BYMONTHDAY rule. #530
Conversation
Pull Request Test Coverage Report for Build 3004908279
💛 - Coveralls |
Pull Request Test Coverage Report for Build 3012284281
💛 - Coveralls |
@@ -675,6 +676,28 @@ suite('recur_iterator', function() { | |||
'2015-03-31T08:00:00' | |||
] | |||
}); | |||
testRRULE('FREQ=MONTHLY;INTERVAL=3;BYMONTHDAY=-1', { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At a glance, it's not clear to me what this test is looking for. A comment would be good, or even a failure reason if testRRULE()
provides for that.
@@ -302,9 +302,13 @@ ICAL.RecurIterator = (function() { | |||
} | |||
|
|||
} else if (this.has_by_data("BYMONTHDAY")) { | |||
if (this.last.day < 0) { | |||
// Attempting to access `this.last.day` will cause the date to be normalised and |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Appreciate the comments here, let me understand this review. 😅
66511d2
to
2b34544
Compare
I've added some comments to the individual tests. It's probably still as clear as mud. I also moved the inner |
Originally bug 1789362. Calculation of the initial recurrence date is wrong where
BYMONTHDAY
is negative.For example, if the rule is
FREQ=MONTHLY;INTERVAL=3;BYMONTHDAY=-1
the event recurs at 2, 5, 8 etc. months instead of 3, 6, 9 etc.. I've figured out that this is because we're storing a negative day value in anICAL.Time
. When we attempt to read the value it gets normalised to the previous month because the day value is negative.