2 Replies Latest reply on May 11, 2016 5:06 PM by minwenlo

    Apex 5 Calendar Region - End Date off by one

    Jeffrey Kemp

      If I create a calendar region based on a table with a Start Date and End Date (no time values), and set the End Date Column attribute, the region appears to interpret the end dates as being the day after the actual last day of a multi-day event.


      For example, if I have an event that starts on 1 Jan and ends on 10 Jan, the hover-text will show the correct dates ("Jan 1 - 10, 2016") but it will only be rendered on the calendar on Jan 1 to 9 (missing the 10th).


      I tried modifying the query to use END_DATE+1 as the end date, which causes the calendar to render the event on the correct dates on the calendar, but now the hover-text shows the wrong dates ("Jan 1-11, 2016") and there is no option to change or hide this part of the hover-text. I also tried END_DATE+0.99999 but this had no effect.


      Note: a similar off-by-one problem exists for the Drag and Drop PL/SQL Code - I have to subtract one day from the end date to get it to work correctly (this is not a big issue in itself, the workaround works):

      UPDATE events
            ,end_date   = TO_DATE(:APEX$NEW_END_DATE, 'YYYYMMDDHH24MISS') - 1
      WHERE event_id = :APEX$PK_VALUE;

      Strangely enough, if I drag-and-click a date range, the date passed in the Create Link using &APEX$NEW_END_DATE. is the correct date as expected!

        • 1. Re: Apex 5 Calendar Region - End Date off by one

          Found the same problem. Tried messing with show times but still had the same problem. And when you have show times on you can't change the length of an entry.


          Something definitely not quite right there..


          Odd that I've not been able to find anyone else complaining about this. Makes me think that it's me (and Jeff) doing something wrong?


          (Obligatory xkcd: Wisdom of the Ancients)

          • 2. Re: Apex 5 Calendar Region - End Date off by one

            I got the answer from Oracle support.

            Below is what they told me.


            APEX calendar leverages the jQuery FullCalendar Plugin. That Plugin treats end dates - by design - as exclusive.



            When Show Time is set, then the end date is exclusive at the 'second' level, so for the calendar it ends the second before (which does not make a difference for display). If Show Time is not set, it's exclusive at the 'day' level - which makes a difference for display.


            So the bug is actually in our Hover Text (tooltip) it will be fixed next release.


            So there are two workarounds


            1) set "Show Time" to Yes (and maybe disable day and week views)


            2) set Show Time" to No, add one day to the end date in the SQL query and (for now) disable tooltips.

            1 person found this helpful