#236 Entry editor behaves poorly when an entry ends at midnight

MRBS (195)

MRBS 1.4.8.

The entry editor behaves poorly when an entry ends at midnight. To reproduce, define an area with two time slots midnight-noon, noon-midnight, for example. (First slot starts 00:00, Resolution 720 minutes, Default 1440 minutes, Last slot starts 12:00.)

There are three problems:

1) If an event starts and ends at midnight, the dynamically generated slot selector displays "n days, 24 hours" instead of "n+1 days" as one would expect.

2) The slot selector can have two options labeled "00:00" -- one representing 0 seconds from the start of the day and another representing 86400 seconds from the start of the day. A user can distinguish the two midnights only by the order in which they are presented, which may be confusing.

3) When "All day" is checked, the first time slot is automatically selected as the start time, and the last time slot is automatically selected as the end time. However, if the end time is midnight, then the end date field has a value that is erroneously advanced by one day, since the displayed end date is derived from 00:00:00 of the following day, while the end time field is 24:00:00 of the preceding day (even though it is labeled as "00:00" in the selector). As a result, toggling the "All day" button on an all-day entry has the effect of extending or shortening the entry by 24 hours, when the user would expect it to have no effect.

This patch fixes the time slot selector to handle midnight wraparound.

A fix to header.inc addresses problem (1).

For problem (2), in the end-time selector, label midnight at the end of the day as "23:59" instead of "00:00". (This is a visual change only; the associated value with that label remains 86400 seconds). It would have been nice to label it as "24:00", but I don't see how that can be achieved using utf8_strftime() unless we perform a specific substitution on its output.

To fix problem (3), when generating the end-date and -time selectors, internally pretend that midnight at the end of the day is 23:60:00 instead of 00:00:00 of the following day. This fools the end date and time selectors into treating midnight as the end of the preceding day rather than the start of the following day. Then, it is possible to toggle the "All day" button on an event that ends at midnight without having to change the date.


  • dwpoon

    dwpoon - 2012-03-08

    Patch against MRBS 1.4.8

  • dwpoon

    dwpoon - 2013-02-12

    Patch against MRBS 1.4.9

  • Campbell Morrison

    I have fixed (1) in the trunk with Rev 2699.

    Problem (2) is I believe no longer a problem. As part of the changes made when allowing the booking day to run past midnight, the notation "* hhmm" was introduced to donate a time on the following day, in much the same way that airlines display their timetables. I think this is preferable to fiddling the time to 23:59, which is not quite accurate and would also be confusing if you had a resolutuion of one minute, or representing it as 24:00, which is technically invalid.

    I will look at problem (3) later.


  • Campbell Morrison

    I've fixed problem (3) in Rev 2701, though not in the way suggested. There were some more fundamental issues causing the problem.


  • John Beranek

    John Beranek - 2015-09-16
    • status: open --> closed


Cancel  Add attachments

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks