Skip to content

Commit

Permalink
Fix invalid occurrences for BYDAY rrules
Browse files Browse the repository at this point in the history
  • Loading branch information
sciyoshi committed Apr 1, 2024
1 parent e49c6ca commit 9ce978c
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
3 changes: 2 additions & 1 deletion rrule/src/iter/counter_date.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ impl DateTimeIter {
self.month = 12;
year_div -= 1;
}
self.increment_yearly(year_div)?;
self.year += i32::from(year_div);
checks::check_year_range(self.year)?;
}
Ok(())
}
Expand Down
21 changes: 21 additions & 0 deletions rrule/src/tests/rrule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1169,6 +1169,27 @@ fn monthly_by_nweekday_large() {
);
}

#[test]
fn issue_104() {
let rrule = RRule {
freq: Frequency::Monthly,
interval: 2,
count: Some(3),
by_weekday: vec![NWeekday::Nth(-1, Weekday::Mon)],
..Default::default()
};
test_recurring_rrule(
rrule,
true,
ymd_hms(2023, 10, 30, 9, 0, 0),
&[
ymd_hms(2023, 10, 30, 9, 0, 0),
ymd_hms(2023, 12, 25, 9, 0, 0),
ymd_hms(2024, 2, 26, 9, 0, 0),
],
);
}

#[test]
fn monthly_by_month_and_weekday() {
let rrule = RRule {
Expand Down

0 comments on commit 9ce978c

Please sign in to comment.