simshaun / recurr

PHP library for working with recurrence rules (RRULE); meant to help with recurring calendar events.
Other
1.21k stars 135 forks source link

Non-Gregorian Recurrence Rules #87

Open matejsvajger opened 8 years ago

matejsvajger commented 8 years ago

Hi there!

Out of all three main opensource php libraries that are handling RRULES this is the only one that tries to address the problem with occurrences on non existing dates.

For example, if my birthday is on 29th of February, then my birthday will show up on calendar every four years.

I see you're trying to handle this through ArrayTransformerConfig with enableLastDayOfMonthFix();

I know the rfc5545 explicitly states such occurences should be skipped, however there is an update to it since last year which address exactly this problem with introduction of SKIP property.

Here's a more common and real world example than the brithday on 29.02. where this comes handy:

Imagine you want to schedule a subscription credit card payment monthly but you can make it only on weekdays. The initial payment for subscription is made on Thursday 31st of March 2016. The next occurrence would fall on 31.04.2016 which obviously doesn't exist. Now using the enableLastDayOfMonthFix would fix this and set the date on 30.04.2016 but this day falls on Saturday. Moving to the first day of next month also falls on weekend.

A simple rule like this: FREQ=MONTHLY;BYDAY=MO,TU,WE,TH,FR;SKIP=FORWARD would move the occurrence to the next working day on 2.5.2016.

My question is; are there any plans on implementing this behavior?

simshaun commented 8 years ago

I had no plans for it, but I'll add this to my list of things to check out when I get around to refactoring this library.