svsticky / constipated-koala

Management system for our study association
https://koala.svsticky.nl/
GNU General Public License v3.0
16 stars 4 forks source link

Add to calendar: Incorrect end date for activities spanning whole day(s) #1083

Closed SilasPeters closed 1 month ago

SilasPeters commented 5 months ago

Current Behaviour

When clicking on the link to add an activity to your calendar, (and when the activity spans over multiple days,) and when no specific end time is specified for the final day (assuming koala stored the activity as lasting the whole day), the timestamp filled in your agenda is 00:00 on the start of the final day.

The consequence is, that when an activity is from 1-3 Jan, but no end time is specified (just 3 Jan), then the agenda displays the activity only on 1-2 Jan, as it ends at 3 Jan 0:00.

Expected Behaviour

The timestamp of 3 Jan is 23:59, or even better, the calendar knows 'whole days' are specified and no timestamps have to be supplied.

Notes

I believe the bug is that we specify no timestamp, but also not that the activity spans over whole days - without specific timestamps.

This bug might also influence activities which do not span over multiple days, but just do not have a specific end time

SilasPeters commented 5 months ago

@stickyPiston can koala distinguish activities lasting whole days from activities lasting until a specific point in time? If so, this is a better alternative than setting the end-time to 23:59, when dealing with activities with no specific times.

This is an example of how I would expect such events to be present in the calendar: Screenshot of 'Whole day' option in google calendar

This can be achieved by changing the dates field to have UTC dates without time (so 20240213 instead of 20240213T123040Z)

stickyPiston commented 5 months ago

Hmm... that's interesting. Koala saves the start and end time separately and either or both can be nil. So for the case that both are nil I see no problem, though we might need to test to see if it handles the case that only one is nil (or disregard that situation altogether)

SilasPeters commented 5 months ago

I tried combining null timestamps, and these are the results:

Both timestamps Start date: 20240212T173000Z, end date: 20240212T210000Z Test result

No start timestamp Start date: 20240212, end date: 20240212T210000Z Test result

No end timestamp Start date: 20240212T173000Z, end date: 20240212 Test result

Neither timestamps Start date: 20240212, end date: 20240212 Test result

I guess this can be summarised as:

If no timestamp is given, it is defaulted to 00:00. However, if the start date does not have a timestamp, the event is considered to last whole days (and the timestamp of the end date is discarded).

Thus my suggestion is to 1) disallow one timestamp to be unspecified if another is specified, and that 2) if no timestamps were specified, then no timestamps are included in the generated link, and if there were timestamps specified, then we would just copy them over into the link.

This way, if you specify times then the times are included. If you don't then the event will be marked as lasting whole day(s). This matches the intuition of leaving the timestamp fields blank.

SilasPeters commented 1 month ago

This was closed by #1084