From 82bfd76f1f5d3035c5741abfaea6721a7d44106f Mon Sep 17 00:00:00 2001 From: Jan Schneider Date: Tue, 2 Feb 2010 23:44:35 +0100 Subject: [PATCH] Fix generating cover dates without start or end dates provided. --- kronolith/lib/Kronolith.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/kronolith/lib/Kronolith.php b/kronolith/lib/Kronolith.php index 86b89bc6c..469b51d48 100644 --- a/kronolith/lib/Kronolith.php +++ b/kronolith/lib/Kronolith.php @@ -611,14 +611,15 @@ class Kronolith 'sec' => $next->sec)); } } else { + /* Event only occurs once. */ if (!$coverDates) { $results[$event->start->dateString()][$event->id] = $json ? $event->toJson() : $event; } else { - /* Event only occurs once. */ $allDay = $event->isAllDay(); /* Work out what day it starts on. */ - if ($event->start->compareDateTime($startDate) < 0) { + if ($startDate && + $event->start->compareDateTime($startDate) < 0) { /* It started before the beginning of the period. */ $eventStart = clone $startDate; } else { @@ -626,7 +627,8 @@ class Kronolith } /* Work out what day it ends on. */ - if ($event->end->compareDateTime($endDate) > 0) { + if ($endDate && + $event->end->compareDateTime($endDate) > 0) { /* Ends after the end of the period. */ if (is_object($endDate)) { $eventEnd = clone $endDate; -- 2.11.0