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

Issue using YEARLY frequency and BYMONTHDAY #127

Open
vkartaviy opened this issue Jul 22, 2024 · 2 comments
Open

Issue using YEARLY frequency and BYMONTHDAY #127

vkartaviy opened this issue Jul 22, 2024 · 2 comments

Comments

@vkartaviy
Copy link

I encountered an error with the recurrence rule that has yearly frequency and a specific month day.

The expected dates are not being generated correctly.

Could you please confirm that issue is exists?

Failed test-case:

#[test]
fn yearly_bymonthday() {
    let rrule_set = "DTSTART;TZID=Asia/Kolkata:20210420T080000\nRRULE:FREQ=YEARLY;BYMONTHDAY=20"
        .parse::<RRuleSet>()
        .unwrap();

    let dates = rrule_set
        .all(5)
        .dates;

    common::check_occurrences(&dates, &[
        "2021-04-20T08:00:00+05:30",
        "2022-04-20T08:00:00+05:30",
        "2023-04-20T08:00:00+05:30",
        "2024-04-20T08:00:00+05:30",
        "2025-04-20T08:00:00+05:30",
    ]);
}
Given: [
    "2021-04-20T08:00:00+05:30",
    "2021-05-20T08:00:00+05:30",
    "2021-06-20T08:00:00+05:30",
    "2021-07-20T08:00:00+05:30",
    "2021-08-20T08:00:00+05:30",
]
Expected: [
    "2021-04-20T08:00:00+05:30",
    "2022-04-20T08:00:00+05:30",
    "2023-04-20T08:00:00+05:30",
    "2024-04-20T08:00:00+05:30",
    "2025-04-20T08:00:00+05:30",
]
@AlbanWS
Copy link
Contributor

AlbanWS commented Jul 23, 2024

Hi,

Your current string says : "Every year on the 20th", which is valid every months.
You want to say : "Every year in May on the 20th".

If you want May (the 4th month) : BYMONTH=4

Therefore your RruleSet string should be :
DTSTART;TZID=Asia/Kolkata:20210420T080000\nRRULE:FREQ=YEARLY;BYMONTH=4;BYMONTHDAY=20

You can try your Rrules here if you want to understand it better

@vkartaviy
Copy link
Author

@AlbanWS thanks for the reply, I wish Google Calendar treat it the same, lol 😭

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

No branches or pull requests

2 participants