Page MenuHomePhabricator

Store "All Day" events in a way that is compatible with EditEngine
ClosedPublic

Authored by epriestley on Jul 15 2016, 5:30 PM.
Tags
None
Referenced Files
F14052203: D16305.diff
Fri, Nov 15, 7:12 AM
F14034305: D16305.diff
Sat, Nov 9, 11:31 PM
F14021297: D16305.diff
Wed, Nov 6, 7:01 AM
F13986486: D16305.diff
Mon, Oct 21, 3:20 AM
F13986103: D16305.diff
Mon, Oct 21, 12:36 AM
F13972587: D16305.id.diff
Oct 17 2024, 7:56 PM
F13971672: D16305.id39214.diff
Oct 17 2024, 2:39 PM
F13956224: D16305.diff
Oct 14 2024, 4:48 AM
Subscribers
None

Details

Summary

Ref T11326. Normally, events occur at a specific epoch, independent of the viewer. For example, if we're having a meeting in 35 hours, every user who looks at the event will see that it starts 35 hours from now.

But when an event is "All Day", the start time and end time depend on the viewer. A day like "Christmas" does not start at the same time for everyone: it starts sooner if you're in a more-eastern timezone. Baiscally, an event on "July 15th" starts whenever "July 15th" starts for whoever is looking at it.

Previously, we stored these events by using the western-most and eastern-most timezones as the start and end times (the earliest possible start and latest possible end).

This worked OK, but we get into a bunch of trouble with EditEngine, mostly because each field can be updated individually now. We can't easily tell if an event is all-day or not when reading or updating the start time and end time, and making that easier would introduce a huge amount of complexity.

Instead, when we update the start or end time, we write two times:

  • The epoch timestamp of the time the user entered, which is the start time we will use if the event is a normal event.
  • The epoch timestamp of 12:00 AM in UTC on the same date as the local date the user entered. This is pretty much like just storing the date the user actually typed. This is what w'ell use if the event is an all-day event.

Then, no matter whether the event is later made all-day or not, we have all the information we need to display it correctly.

Test Plan
  • Created and edited all-day events.
  • Migrated existing all-day events, which appeared to survive without problems. (Note that events all-day which were created or edited in the last couple of days master won't survive this mutation correctly and will need to be fixed.)
  • Created and edited normal, recurring, and recurring all-day events.
  • Swapped back to stable, created an event, specifically migrated it forward, made sure it survived with times intact.

Diff Detail

Repository
rP Phabricator
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

epriestley retitled this revision from to Store "All Day" events in a way that is compatible with EditEngine.
epriestley updated this object.
epriestley edited the test plan for this revision. (Show Details)
epriestley added a reviewer: chad.

I seem to recall on PHP iCalendar I cheated and made any event that was at least 23 hours, 45 minutes (or something), and 'all-day' event in the UI.

I don't think we can do that without getting some cases wrong.

For example, suppose I have a 24-hour hackathon, but it starts at 7PM PST in our future offices. So I enter "2016-07-15 7:00 PM" as the start time, and "2016-07-16 7:00 PM" as the end time, and do not check "All Day Event".

That's a 24-hour event, but if we silently convert it into an "All Day" event these bad things happen:

  • It appears on only one of 7/15 or 7/16, even though the event takes place on both days, so I might miss one or the other day.
  • It appears at the top of the day as an all-day event, although it has a very specific start time and the start time is important.
  • If a viewer with a UTC offset of more than 5 hours relative to mine looks at the event, they may see that it occurs on the wrong day. If they were planning to attend remotely, they may miss the event completely.

We could possibly do "if it's more than 23.75 hours long and starts within 15 minutes of 12:00 AM" or something, but that doesn't seem especially useful to me.

Well, yeah I just did JIT display (raw reading of an ics file, no database backing).

chad edited edge metadata.
This revision is now accepted and ready to land.Jul 15 2016, 6:01 PM
This revision was automatically updated to reflect the committed changes.