<?xml version="1.0" encoding="UTF-8"?> 
<?xml-stylesheet href="https://dev.horde.org/themes/horde//default/feed-rss.xsl" type="text/xsl"?> 
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> 
 <channel> 
  <title>isAllDay() logic incorrect?</title> 
  <pubDate>Fri, 10 Apr 2026 14:49:34 +0000</pubDate> 
  <link>https://bugs.horde.org/ticket/8176</link> 
  <atom:link rel="self" type="application/rss+xml" title="isAllDay() logic incorrect?" href="https://bugs.horde.org/ticket/8176/rss" /> 
  <description>isAllDay() logic incorrect?</description> 
 
   
   
  <item> 
   <title>I&#039;m running into what I believe is a bug in the display of n</title> 
   <description>I&#039;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 = &#039;eed64d52188a4a4732607fa1f12f812a&#039;\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-&gt;start-&gt;hour == 0 &amp;&amp; $this-&gt;start-&gt;min == 0 &amp;&amp; $this-&gt;start-&gt;sec == 0 &amp;&amp;

            (($this-&gt;end-&gt;hour == 0 &amp;&amp; $this-&gt;end-&gt;min == 0 &amp;&amp; $this-&gt;end-&gt;sec == 0) ||   

             ($this-&gt;end-&gt;hour == 23 &amp;&amp; $this-&gt;end-&gt;min == 59)) &amp;&amp;                        

            ($this-&gt;end-&gt;mday &gt; $this-&gt;start-&gt;mday ||                                     

             $this-&gt;end-&gt;month &gt; $this-&gt;start-&gt;month ||                                   

             $this-&gt;end-&gt;year &gt; $this-&gt;start-&gt;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&#039;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&#039;s end date. */                         

if ($event-&gt;end-&gt;hour != 0 ||                                 

    $event-&gt;end-&gt;min != 0 ||                                  

    $event-&gt;end-&gt;sec != 0 ||                                  

    $event-&gt;start-&gt;compareDateTime($event-&gt;end) == 0 ||       

    $event-&gt;isAllDay()) {                                     

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

} else {                                                      

    $eventEnd = new Horde_Date(                               

        array(&#039;hour&#039; =&gt;  23,                                  

              &#039;min&#039; =&gt;   59,

              &#039;sec&#039; =&gt;   59,

              &#039;month&#039; =&gt; $event-&gt;end-&gt;month,

              &#039;mday&#039; =&gt;  $event-&gt;end-&gt;mday - 1,

              &#039;year&#039; =&gt;  $event-&gt;end-&gt;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-&gt;start-&gt;hour == 0 &amp;&amp; $this-&gt;start-&gt;min == 0 &amp;&amp; $this-&gt;start-&gt;sec == 0 &amp;&amp;

       (($this-&gt;end-&gt;hour == 0 &amp;&amp; $this-&gt;end-&gt;min == 0 &amp;&amp; $this-&gt;end-&gt;sec == 0 &amp;&amp;

         ($this-&gt;end-&gt;mday &gt; $this-&gt;start-&gt;mday ||

          $this-&gt;end-&gt;month &gt; $this-&gt;start-&gt;month ||

          $this-&gt;end-&gt;year &gt; $this-&gt;start-&gt;year)) ||

        ($this-&gt;end-&gt;hour == 23 &amp;&amp; $this-&gt;end-&gt;min == 59 &amp;&amp; $this-&gt;end-&gt;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)).



That appears to work in my tests, but I&#039;m not entirely sure if there are other edge cases I&#039;m not considering.  I&#039;ve attached a patch with that change anyway.</description> 
   <pubDate>Thu, 09 Apr 2009 16:56:32 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/8176#t53603</link> 
  </item> 
   
  <item> 
   <title>There is no patch attached.</title> 
   <description>There is no patch attached.</description> 
   <pubDate>Thu, 16 Apr 2009 22:02:25 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/8176#t53700</link> 
  </item> 
   
  <item> 
   <title>Sorry, patch attached with what I believe to be the fix.



</title> 
   <description>Sorry, patch attached with what I believe to be the fix.



</description> 
   <pubDate>Thu, 16 Apr 2009 22:09:24 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/8176#t53705</link> 
  </item> 
   
  <item> 
   <title>Changes have been made in CVS for this ticket:

http://cvs.h</title> 
   <description>Changes have been made in CVS for this ticket:

http://cvs.horde.org/diff.php/kronolith/lib/Driver.php?rt=horde&amp;r1=1.116.2.81&amp;r2=1.116.2.82&amp;ty=u</description> 
   <pubDate>Sun, 26 Apr 2009 13:52:08 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/8176#t53880</link> 
  </item> 
   
  <item> 
   <title>Fixed in CVS.</title> 
   <description>Fixed in CVS.</description> 
   <pubDate>Sun, 26 Apr 2009 13:53:18 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/8176#t53881</link> 
  </item> 
   
   
 
 </channel> 
</rss> 
