Oh, you’re right, it does add a bit of extra information to the date field so that bug needs to be fixed with more lines of code.
$this->output .= "\t".$this->_makeDateSelector($val[0], $fm_label[$x], $tooltip, $editSD)."\n";
to
$this->output .= "\t".$this->_makeDateSelector($val[0], $fm_label[$x], $tooltip, date('Y-m-d',strtotime($editSD)))."\n";
As an example for the second bug: If you add a Monday/Wednesday/Friday recurring event, instead of actually recurring on those days, the existing code continues recurring on the day of the week that the event happened until the final recurrence date.
So far, I don’t think there is any easy-to-implement, better solution than the brute force check-- going through every day until the final recurrence date beginning on the start date, checking if the target date is one of the weekdays specified, then adding it to the list if so, works decently. At the end of the week you could jump the interval number of weeks too, but I haven’t tested that.
(_getRepeatDates(), case "w")
case "w":
//add the dates in play for weekly recurrance to an array
//$days = $startdate .. $untildate (aka endDate);
$days = array();
$added = strtotime($startDate);
array_push($days, $added);
while ($added<strtotime($endDate)){
$added = strtotime('+1 day',$added);
array_push($days, $added);
}
foreach ($days as $targetDate) {
$dayOfWeek=date('w',$targetDate);
if (in_array($dayOfWeek,$onwd)) {
if ($debug) echo 'adding'.date('Y-m-d',$targetDate);
$ar_Recur[] = date('Y-m-d', $targetDate);
}
}
Maybe this could go in the while loop for intervals:
if ((date('w',$added)!=6 || $added == $startDate) || $interval == 1) {
//roll a day as long as the $added+1 day is a not new week (saturday) or is the initial date (possibly a Saturday too).
$added = strtotime("+1 day",$added);
array_push($days, $added);
}
else {
//We have a non-1 interval and it is a new week, so we should jump our interval-1 weeks.
$N=($interval-1)*7+1; //number of days to jump,+1 for normal saturday->sunday increment.
$added = strtotime("+$N days",$added);
array_push($days, $added);
}