I just downloaded and installed the latest dev version of the Date module and one of the first dates that I created was a repeating one. I set it to July 20, 2009 and then said to repeat every two weeks until July 31, 2010. The first repeat is set to July 27, which is only 1 week away. Then there is an event every 2 weeks starting from July 27 as the base date. So *all* of the repeating dates are off by 1 week.

Let me know if you can't replicate this and I will provide more data.

CommentFileSizeAuthor
#5 repeatingdates.patch1.01 KBldweeks
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

emilymoi’s picture

+1 .. Just noticed this too.

emilymoi’s picture

Took a quick look at this because this was a show stopper for me. It looks like the problem exists in the (huge!) date_repeat_calc function within date_repeat_calc.inc.

      // Back up to the beginning of the week in case we are somewhere in the
      // middle of the possible week days, needed so we don't prematurely
      // jump to the next week. The date_repeat_add_dates() function will
      // keep dates outside the range from getting added.
      if (date_format($current_day, 'l') != $day) {  
        date_modify($current_day, '-1 '. $week_start_day);
      }

This will compare 'Monday' != 'MO'.. so it will always fail. I have changed this to:

 if (strtoupper(substr(date_format($current_day, 'l'), 0, 2)) != $day) {  
        date_modify($current_day, '-1 '. $week_start_day);
 }

And it is working here.. However, I spent a total of 15 minutes looking at this and testing it, so it's probably a very kludgy solution.

emilymoi’s picture

Status: Active » Needs review
jtbayly’s picture

I'd be happy to test this if somebody could make it into a patch.

ldweeks’s picture

FileSize
1.01 KB

Here's a patch...

pauldawg’s picture

.

mxmilkiib’s picture

subscribe

mxmilkiib’s picture

subscribe (whoopsy, dupe that can't be deleted - bad wi-fi..)

mxmilkiib’s picture

ah, setting an event to repeat "Every 14 ... Days" works ok.

HnLn’s picture

subscribe

gpk’s picture

Subs. Using 6.x-2.4. Have not tried 6.x-2.6 or latest 6.x-dev as yet.

KarenS’s picture

Status: Needs review » Fixed

Actually we have the right way to compare the value but are making the wrong comparison. Made a different fix (use $day_names[$day] instead of $day).

gpk’s picture

Thanks Karen. And happy new year!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.