aboutsummaryrefslogtreecommitdiffstats
path: root/functions
diff options
context:
space:
mode:
authordavef <davefd2@users.sourceforge.net>2005-05-09 18:46:12 +0000
committerdavef <davefd2@users.sourceforge.net>2005-05-09 18:46:12 +0000
commitcf8925e6a6f87638abd51107866e1f8fa4837d8f (patch)
tree41cdd5378a6b8cfee18b9f29a1be6bfd828cb514 /functions
parent82e495a8c7086b1190fac1a09d39b34c369d8275 (diff)
downloadphpicalendar-cf8925e6a6f87638abd51107866e1f8fa4837d8f.tar.gz
phpicalendar-cf8925e6a6f87638abd51107866e1f8fa4837d8f.tar.bz2
phpicalendar-cf8925e6a6f87638abd51107866e1f8fa4837d8f.zip
SF Bug #1023229
Relatively simple fix to a complex, that changes the weekly code to render to the window of $next_date_range -> $next_date_range + $interval weeks. Took me a while to wrap my head around this one - I knew what the solution was, but wasn't sure if it handles everything. Still not 100% sure about the edge cases, though.
Diffstat (limited to 'functions')
-rw-r--r--functions/ical_parser.php17
1 files changed, 11 insertions, 6 deletions
diff --git a/functions/ical_parser.php b/functions/ical_parser.php
index 2589477..8872461 100644
--- a/functions/ical_parser.php
+++ b/functions/ical_parser.php
@@ -515,15 +515,20 @@ foreach ($cal_filelist as $filename) {
$recur_data[] = $next_date_time;
break;
case 'WEEKLY':
+ // Populate $byday with the default day if it's not set.
if (!isset($byday)) {
- $next_date = dateOfWeek(date('Ymd', $next_range_time),$bd);
- $next_date_time = strtotime($next_date);
- $recur_data[] = $next_date_time;
- } elseif (is_array($byday)) {
+ $byday[] = strtoupper(substr($daysofweekshort_lang[date('w', $next_range_time)], 0, 2));
+ }
+ if (is_array($byday)) {
foreach($byday as $day) {
$day = two2threeCharDays($day);
- $next_date = dateOfWeek(date('Ymd', $next_range_time),$day);
- $next_date_time = strtotime($next_date);
+ $next_date_time = strtotime($day,$next_range_time) + (12 * 60 * 60);
+ // Since this renders events from $next_range_time to $next_range_time + 1 week, I need to handle intervals
+ // as well. This checks to see if $next_date_time is after $day_start (i.e., "next week"), and thus
+ // if we need to add $interval weeks to $next_date_time.
+ if ($next_date_time > strtotime($week_start_day, $next_range_time) && $interval > 1) {
+ $next_date_time = strtotime('+'.($interval - 1).' '.$freq_type, $next_date_time);
+ }
$recur_data[] = $next_date_time;
}
}

© 2014-2024 Faster IT GmbH | imprint | privacy policy