Do not shift start time when setting an end time that ends after midnight with a smaller hour number
This is a follow-up to #91 (closed), and related to #1121.
Reproduction instructions
To reproduce, especially with !376, in 24-hour time format mode:
- Create an event with the event editor dialog, switch from "All day" to time-based
- Set the start hour to
21
; notice the end time gets automatically set to22
hours - Set the end hour to
02
(two in the morning)
(Note that you could use different times, such as 17h start time then setting 01h end time, you'd then end up with a 00h start time... but I wanted to illustrate the example simply with an evening time like 21h.)
Actual result
Start time gets auto-changed to 01
while end date is considered today's 02h (instead of the next day's 02h).
This is because the event editor tries to guess the user's intent, so it guessed the user wanted to shift the event back in time to schedule it sooner, as an "end time before the start time" does not make sense. There are some situations where it makes sense for it to try to do so (for example if you had an event scheduled from 16h to 18h, and then you change the end time to 15h so its start time becomes 13h, that kinda makes sense because surely you meant to just shift the event backwards rather than have an event from 16h today until 15h tomorrow)...
Expected result
Under certain circumstances (big time difference? evening start times?), start time should remain untouched (in this case, 21
) and end date should be bumped to next day with the end time the user has provided.
Questions and caveats
The big question is, when/how to decide the auto-adjustment logic? Where/how do you draw the line between that "overnight" situation and something like "I want to shift/reschedule an event backwards within the day" (ex: shift an event that was scheduled from 21h to 23h, back to an event that happens between 11h and 13h)?
- Based on the time of the day where the event start time was set (ex: make a distinction between events that started in the evening, vs earlier events)? Or maybe a combination of "start time is between 18h and 24h, end time is between 00h and 12h = considered an overnight event"?
- Based on the amount of hours shifted (time difference being bigger than 8 hours? time difference between bigger than 2x the previous duration of the event?)...?
Other potential caveat: how to handle this stuff with the 12-hours "AM / PM" system (because it's tricky enough with the 24-hour format already...)?
Alternate solution
...or just don't try to guess / never auto-shift the start times and start dates for the user, and whenever the dialog encounters a nonsensical "end time/date is before start time/date" situation, highlight in red the problematic fields + disable (make insensitive) the "Done" button until the situation has been corrected by the user? This is Google Calendar's approach:
- It only adjusts the end date "if necessary for #1121" when it means adding an extra day to the end date;
- It never touches the start time/date when changing the end time/date;
- If the user somehow manages to do something nonsensical, like setting the end time before the end date (in which case it adds an extra day to the end date) AND re-setting the end date to the previous day, then Google Calendar blocks the "Save" button and marks the end time & date fields in red until the user corrects them:
google_calendar_date_and_hours_shifting_heuristic