Skip to content
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

Invalid occurrences for "every 2 months on the last Monday" #104

Closed
tomquist opened this issue Feb 22, 2024 · 3 comments · Fixed by #106
Closed

Invalid occurrences for "every 2 months on the last Monday" #104

tomquist opened this issue Feb 22, 2024 · 3 comments · Fixed by #106

Comments

@tomquist
Copy link
Contributor

The following test fails:

#[test]
fn issue_YY() {
    let dates = "DTSTART;TZID=Europe/London:20231030T140000
RRULE:FREQ=MONTHLY;INTERVAL=2;BYDAY=-1MO"
        .parse::<RRuleSet>()
        .unwrap()
        .all(3)
        .dates;

        common::check_occurrences(
            &dates,
            &[
                "2023-10-30T14:00:00+00:00",
                "2023-12-25T14:00:00+00:00",
                "2024-02-26T14:00:00+00:00",
            ],
        );
}

This is the output:

Given: [
    "2023-10-30T14:00:00+00:00",
    "2023-12-25T14:00:00+00:00",
    "2024-03-25T14:00:00+00:00",
]
Expected: [
    "2023-10-30T14:00:00+00:00",
    "2023-12-25T14:00:00+00:00",
    "2024-02-26T14:00:00+00:00",
]

It seems all occurrences after crossing the year 2023/2024 are wrong.

@tomquist
Copy link
Contributor Author

tomquist commented Mar 5, 2024

@fmeringdal I'd be happy to try fixing this, and I would appreciate a pointer into the right direction

@fmeringdal
Copy link
Owner

@tomquist Really busy these days so wont be able to provide much guidance the next couple of weeks. Any help on fixing this is appreciated. My initial suspicion is that something is off in RRuleIter::generate. Also thank you for reporting this issue!

@sciyoshi
Copy link
Contributor

Submitted a fix here #106 which resolves this issue although I'm not 100% sure it's fully correct.

sciyoshi added a commit to sciyoshi/rust-rrule that referenced this issue Apr 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants