6.0.0-beta1
10/18/25

[#8191] isAllDay() has wrong test?
Summary isAllDay() has wrong test?
Queue Kronolith
Queue Version 2.3.1
Type Bug
State Duplicate
Priority 1. Low
Owners
Requester stpierre (at) nebrwesleyan (dot) edu
Created 04/14/2009 (6031 days ago)
Due
Updated 04/16/2009 (6029 days ago)
Assigned
Resolved 04/16/2009 (6029 days ago)
Github Issue Link
Github Pull Request
Milestone
Patch No

History
04/16/2009 09:50:48 PM Michael Rubinsky Comment #3
State ⇒ Duplicate
Reply to this comment
04/14/2009 01:22:55 PM stpierre (at) nebrwesleyan (dot) edu Comment #2 Reply to this comment
Sorry, just realized this was a duplicate of 8176; when I first tried 
submitting this ticket, bugs.horde.org was being wonky and I didn't 
think it went through.
04/14/2009 01:20:24 PM stpierre (at) nebrwesleyan (dot) edu Comment #1
Priority ⇒ 1. Low
Patch ⇒ No
Milestone ⇒
Queue ⇒ Kronolith
Summary ⇒ isAllDay() has wrong test?
Type ⇒ Bug
State ⇒ Unconfirmed
Reply to this comment
I'm running into what I believe is a bug in the display of 
non-recurring all day events.  I have the following event:



SELECT event_title, event_recurtype, event_start, event_end

  FROM kronolith_events WHERE event_id = 'eed64d52188a4a4732607fa1f12f812a'\G

*************************** 1. row ***************************

     event_title: all day

event_recurtype: 0

     event_start: 2009-04-09 00:00:00

       event_end: 2009-04-10 00:00:00



According to the logic in isAllDay() in Driver.php lines 1703-1711, 
that should be an all day event:



function isAllDay()

{

     return ($this->start->hour == 0 && $this->start->min == 0 && 
$this->start->sec == 0 &&

             (($this->end->hour == 0 && $this->end->min == 0 && 
$this->end->sec == 0) ||

              ($this->end->hour == 23 && $this->end->min == 59)) &&

             ($this->end->mday > $this->start->mday ||

              $this->end->month > $this->start->month ||

              $this->end->year > $this->start->year));

}



The start and end hour, minute, and second are all 0; and the end mday 
is greater than the start mday.



Unfortunately, by the time isAllDay() is called on this event, the end 
mday has been changed by code in Kronolith.php:



/* If the event doesn't end at 12am set the end date to the

  * current end date. If it 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->isAllDay()) {

     $eventEnd = Util::cloneObject($event->end);

} else {

     $eventEnd = new Horde_Date(

         array('hour' =>  23,

               'min' =>   59,

               'sec' =>   59,

               'month' => $event->end->month,

               'mday' =>  $event->end->mday - 1,

               'year' =>  $event->end->year));

}



Consequently, when isAllDay() is called, the end mday is no longer 
greater than the start mday, and this event is _not_ displayed as an 
all-day event, but rather as an event that lasts pretty much all of

the day.



I *think* that the fix will be to change the logic in inAllDay() to this:



return ($this->start->hour == 0 && $this->start->min == 0 && 
$this->start->sec == 0 &&

        (($this->end->hour == 0 && $this->end->min == 0 && 
$this->end->sec == 0 &&

          ($this->end->mday > $this->start->mday ||

           $this->end->month > $this->start->month ||

           $this->end->year > $this->start->year)) ||

         ($this->end->hour == 23 && $this->end->min == 59 && 
$this->end->sec == 59)));



The old logic tested for (start is 00:00:00) and (end is 00:00:00 or 
23:59) and (end day is after start day).  This revised logic tests for 
(start is 00:00:00) and (end is 23:59:59 or (end is 00:00:00 and end 
day is after start day)).



I'm not entirely sure that that's the right thing, though.

Saved Queries