> What if the event gets shared - should the dates still be relative to the timezone of the creator?
You mean
What if the event gets shared with someone who doesn't have a calendar that implemented this hypothetical yet super basic and highly useful feature.
Well then, it falls back to the standard 24 hr block, right? Yeah, it would be the timezone that it is currently being shared from because our flag was just telling the event to move itself with the timezone instead of being static.
Is that really that bad? This doesn't sound like a reason not to do this. Because the worst case scenario is that... we end up with the current implementation...
> What if the event is recurring and the creator travels between the occurrences
Here's some shitty pseudocode. You could do this and store as UTC time but I think storing with timezone makes the point clearer.
class Date(...):
def __init__(self,
year : int = 1970,
month : int = 1,
day : int = 1,
hour : int = 0,
minute : int = 0,
second : int = 0,
...
tmz : str = "PST",
**kwargs):
super().__init__()
...
def start_of_day(self):
self._hr, self._minute, self._second = self._sod
def end_of_day(self):
self._hr, self._minute, self._second = self._eod
class Event(...):
def __init__(self,
start_time : Date, # date event begins
end_time : Date, # date event ends
all_day_event : bool = False, # is all day event
tmz : str = "PST", # timezone
tmz_invar : bool = False, # timezone invariant
**kwargs):
super().__init__()
...
self._begin = Date(start_time, tmz=tmz).start_of_day()
self._end = Date(end_time, tmz=tmz).end_of_day()
if all_day_event:
self._begin = self._begin.start_of_day()
self._end = self._end.end_of_day()
self._ade = all_day_event
self._tmz_invar = tmz_invar
class Calendar(...):
...
def display_events(self, ...):
...
for event in self.events:
if event.timezone_invariant:
self.display(event._begin._sod,
event._end._eod)
else:
self.display(event._begin.tmz_offset(self.current_tmz),
event._end.tmz_offset(self.current_tmz))
All day events are marked as starting at the beginning of a day and ending at the end of a day. That being from our Date structure, which holds Month, Day of month, hour, minute, second, whatever precision, as well as special things like when the beginning of the day is and when the end of the day is. Here the function start_of_day() and end_of_day replaces whatever input values for {hour, minute, second, ...} with the appropriate values and attributes _sod and _eod are those values.
This assumed you stored events as a time with a timezone. If you stored events in UTC you'd need different logic. I mean time is messy, but either way we're moving stuff around. I mean we're just _displaying_ offsets when moving timezones, right? Because it would be wild to update all events every time we moved timezones, right? So we have to do some logic to take the date and display it relative to its time
With a timezone invariant flag all we're doing is saying
Look at the year, month, and day. Ignore time and instead, use the day's start time and end time.
> What if the event is recurring and the creator travels between the occurrences, should the times change?
No, IT IS AN ALL DAY EVENT
> When should the times be updated?
They don't, IT IS AN ALL DAY EVENT
> What if a participant uses multiple devices in multiple timezones at the same time?
Doesn't matter, IT IS AN ALL DAY EVENT
I'll raise you a question
What do you do if this is not an all day event and is in a specific time?
Think about that answer.
It is really not a hard problem. Because you are storing the events in some database. Moving timezones is then a conversion process. The invariant flag is just saying "keep the time relative to the day."
> my point is that in the context of calendars even adding a flag can get complex fast.
I don't disagree, but I'm failing to see where this specific issue is an actual problem.