Closed fitztrev closed 10 years ago
I'm open for more opinions/contributions on this. For now I'm going to leave it the way it is.
Ok, just thought I'd share. :) I was running into the same problems while I was writing my own. Mine is for scheduling recurring payments so I had to account for these scenarios.
I've added a configuration option that enables the behavior you are seeking for monthly recurrence. See example in the Warnings section of README.
Tagged v0.1.6
Input
2013-01-31 Monthly Output
2013-01-31 2013-03-31 2013-05-31 2013-07-31 2013-08-31
This behavior is required in my project.
@codepiper That is the default behavior.
@simshaun I think this should be reverted. iCal spec states that those months should be skipped:
Recurrence rules may generate recurrence instances with an invalid date (e.g., February 30) or nonexistent local time (e.g., 1:30 AM on a day where the local time is moved forward by an hour at 1:00 AM). Such recurrence instances MUST be ignored and MUST NOT be counted as part of the recurrence set.
And the "last day" of the month behavior is already possible through proper iCal syntax:
RRULE:FREQ=MONTHLY;INTERVAL=1;BYMONOTHDAY=-1
It will be going away in favor of #87 when I get time. I've got a newborn, so my free time is a bit limited for a while.
Just FYI, I recently had to roll my own recurrence library before I found yours. I was checking out yours to possibly replace the one I wrote. After looking at it, I found a few issues with calculating future dates based on a monthly recurrence.
If my start date is on the 31st, it'll skip all the months that don't have 31 days.
Input
Output
Also, if my start date is the last day of its month, I would expect all monthly frequencies to also be on the last day of each subsequent month.
Input
Output