-
New Feature
-
Resolution: Duplicate
-
Minor
-
None
-
3.1, 3.1.1, 3.1.2
Currently, there is no complete, built in feature of an "All day" event. This causes a few issues:
- For schools, there is no efficient way to include items like "Spring Break" or "End of First Semester"
- Moodle's ambiguity regarding events with no duration cause issues with exports (See MDL-54607)
Moodle actually has some provisions for the "All day" event, however it is incomplete. For example, in calendar/lib.php, around line 1700 (version 3.1) there is this set of lines:
if ($usermidnightstart == $usermidnightend) { |
// Check if we are running all day. |
if ($event->timeduration == DAYSECS) { |
$time = get_string('allday', 'calendar'); |
The logic in this code is faulty because it will never get executed. If {{ $usermidnightstart == $usermidnightend }} then the start and end times must be on the same day. However, if the duration is {{ DAYSECS }} then the end date will always on the following day.
What I propose is to define an "All day" event in Moodle as starting at Midnight and having exactly one minute less than the number of minutes in a full day so that the end time would be 11:59PM (23:59). Then, in displaying, exporting, and importing, a simple check to see if the start time is midnight and duration is also one minute less than a full day would then result in the proper display of the event as "All day".