JonasWanke / rrule

🔁 Recurrence rule parsing & calculation as defined in the iCalendar RFC
https://pub.dev/packages/rrule
Apache License 2.0
52 stars 22 forks source link

Yearly event repeats monthly on no specified BYMONTH #73

Closed tkortekaas closed 7 months ago

tkortekaas commented 7 months ago

The following code:

    final rrule = RecurrenceRule.fromString('RRULE=FREQ=YEARLY;BYMONTHDAY=2');
    print(rrule.getInstances(start: DateTime.utc(2024, 1, 2), after: DateTime.utc(2024, 2, 1)).first);

Gives the following output: I/flutter (27738): 2024-02-02 00:00:00.000Z

I would expect this event to occur each January 2nd, but as you can see it actually repeats each 2nd of the month. I noticed this issue as Google Calendar exported such an event for one of my users, which made it seem like his friend had a birthday each month...

Note: This issue does not happen if you use RRULE=FREQ=YEARLY instead.

Environment:

JonasWanke commented 7 months ago

AFAICT, this is the correct behavior: RCC 5545 specifies that BYMONTHDAY in combination with a frequency of yearly expands the result set and the rrule.js library that this package is based on also behaves like that as well: https://jkbrzt.github.io/rrule/#/rfc/RRULE:FREQ=YEARLY;BYMONTHDAY=2. I'm not sure why Google Calendar produces this output…

tkortekaas commented 7 months ago

Okay clear, thank you, then I will mark this issue as resolved!