When entering a repeating date, it would make sense if the start date is only saved if it matches the repeat rule.

For example, if I add the first date as a Monday and then choose "repeat weekly on Friday", I would like the repetitions to start with the following Friday.

Looking at the code I found out why:

 // The start date always goes into the results, whether or not it meets
  // the rules. RFC 2445 includes examples where the start date DOES NOT
  // meet the rules, but the expected results always include the start date.
  $days = array(date_format($start_date, DATE_FORMAT_DATETIME));

I took a quick look at how Google Calendar does it, and it updates the start date to match the first valid date. We probably don't want this in every case, but it would be very practical. Conversely, it'd be great if the repeating pattern would automatically match the selected start date (ie. when the start date is a Thursday, and I select "repeat weekly", Thursday is automatically selected).

Comments

tmsimont’s picture

Category: feature » bug

I just burned about an hour and a half trying to figure out why I couldn't "cancel" a day of my pattern by adding an exception. Why is this code here? Why can't you have an exception on day 1?

myselfhimself’s picture

Hello,

I also am absolutely interested in any solution for this: being able to have a date repeat form's start date automatically changed in to the first day of the rrule enabled weekdays within range [start date field; rrule UNTIL day].

@floretan, have you sorted your issue yet?

PatchRanger’s picture

PatchRanger’s picture

Status: Active » Closed (duplicate)

Closing as a duplicate of #1365516: Start date is not excluded when an exception for it is set.
Take a look at that issue: it has a patch to review, which does exactly what you requested.