Skip to content

Commit

Permalink
Fix for Issue #5 - Make empty BYDAY in WEEKLY rule repeat the event o…
Browse files Browse the repository at this point in the history
…n the day of the stat timestamp instead of every day of the week.
  • Loading branch information
John Grogg committed Feb 24, 2015
1 parent 3c26310 commit 7c30290
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion class.iCalReader.php
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,13 @@ public function process_recurrences()
$offset = "+$interval week";
// Build list of days of week to add events
$weekdays = array('SU','MO','TU','WE','TH','FR','SA');
$bydays = (isset($rrules['BYDAY']) && $rrules['BYDAY'] != '') ? explode(',', $rrules['BYDAY']) : array('SU','MO','TU','WE','TH','FR','SA');
if(isset($rrules['BYDAY']) && $rrules['BYDAY'] != '') {
$bydays = explode(',', $rrules['BYDAY']);
} else {
$weekTemp = array('SU','MO','TU','WE','TH','FR','SA');
$findDay = $weekTemp[date('w',$start_timestamp)];
$bydays = array($findDay);
}
// Get timestamp of first day of start week
$week_recurring_timestamp = (date('w', $start_timestamp) == 0) ? $start_timestamp : strtotime('last Sunday '.date('H:i:s',$start_timestamp), $start_timestamp);
// Step through weeks
Expand Down

0 comments on commit 7c30290

Please sign in to comment.