In #369020: "Every First Saturday" skips Feb, March #56, @bounsy wrote:
Also, if I have an event that repeats every Saturday and I set it to every day, every week, or every month, it shows up on every Saturday. However, if I change the event to repeat every Saturday and every Tuesday (any two or more days will work) and set it to repeat every day or month, the first week is skipped unless it starts on the day designated by the site configuration as the first day of the week. The first week is not skipped if I set it to repeat every week.
I also hit this same problem. The reason seems to be that the RRULE generated by the view is using a frequency of DAILY, which the current code changes to MONTHLY. This fails when the list of weekdays (BYDAY) spans two months.
Attached is a patch which changes this to WEEKLY. I re-ran it against the simpletests, and no new ones fail (there was one failure even before my change.)
| Comment | File | Size | Author |
|---|---|---|---|
| date_repeat_freq.patch | 944 bytes | gribnif |
Comments
Comment #1
gribnif commentedHere's a test case:
Comment #2
marcingy commentedThis path works for me I had an issue with an event set for every Tuesday and every Thursday which was over 2 months.
Comment #3
Alexander Ufimtsev commentedThe problem appears for both stable and dev version of code for Drupal 5 and 6 and IMHO should be addressed ASAP. Otherwise we have a broken 'Date repeat', which is not caused by PHP: I was able to reproduce this problem with stable 5.x-2.8, 6.x-2.4 and the latest 6.x-2.x-dev code running on PHP version 5.2.10 and PHP 5.3.2.
To reproduce: set up an event that repeats from 25 May until 7th of June 2010 and specify to repeat every mon, tue, wed, thu, and fri.
Events on 1,2,3 and 4th of June are not going to appear, while 7th of June appears fine.
The problem line is with logic that calls date_modify (line 288 in 6.x-2.x-dev code of date_repeat_calc.inc)
When first period (May) is over, current day is set to 1st of June, which is Tue. Once date_modify executes (in a quoted code), it moves current day to June 7th, effectively skipping the first week of a month. However, correct behaviour is not to move the day at all at the start of the period.
This patch fixes it, thanks Gribnif.
Comment #4
mgiffordsubscribe.
Comment #5
karens commentedFixed. Thanks!