From bfb31081e533ce58edea895093c9e6a1e13da2ce Mon Sep 17 00:00:00 2001 From: Jan Schneider Date: Wed, 14 Apr 2010 16:50:29 +0200 Subject: [PATCH] Adjust end time of events that end at midnight for recurring events too. --- kronolith/lib/Kronolith.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/kronolith/lib/Kronolith.php b/kronolith/lib/Kronolith.php index 617d1225d..12556c306 100644 --- a/kronolith/lib/Kronolith.php +++ b/kronolith/lib/Kronolith.php @@ -573,6 +573,22 @@ class Kronolith if ($event->recurs() && $showRecurrence) { /* Recurring Event. */ + /* If the event ends at 12am and does not end at the same time + * that it starts (0 duration), set the end date to the previous + * day's end date. */ + if ($event->end->hour == 0 && + $event->end->min == 0 && + $event->end->sec == 0 && + $event->start->compareDateTime($event->end) != 0) { + $event->end = new Horde_Date( + array('hour' => 23, + 'min' => 59, + 'sec' => 59, + 'month' => $event->end->month, + 'mday' => $event->end->mday - 1, + 'year' => $event->end->year)); + } + /* We can't use the event duration here because we might cover a * daylight saving time switch. */ $diff = array($event->end->year - $event->start->year, -- 2.11.0