anufrievroman / calcure

Modern TUI calendar and task manager with minimal and customizable UI.
https://anufrievroman.gitbook.io/calcure
MIT License
1.51k stars 43 forks source link

Events spanning multiple days are not (well) supported #68

Closed jose1711 closed 9 months ago

jose1711 commented 10 months ago

If an event spans multiple days it only shows on the day it starts. It would be more intuitive if the event is repeated for all days it is in effect.

anufrievroman commented 9 months ago

As far as I remember, this was the limitation of ics library (assuming you mean events from ics files), it did not parse multi days events. Hopefully with icalendar we can bypass that.

jose1711 commented 9 months ago

Latest changes to timezone conversions introduced an issue:

datetime.date(2023, 1, 1).astimezone  # AttributeError: 'datetime.date' object has no attribute 'astimezone'

Furthermore multiday event does not mean the time difference is larger than 1 day.

start = datetime.datetime(2023, 1, 1, 23, 0)
end = datetime.datetime(2023, 1, 2, 5, 0)
is_multiday = True if (end - start).days > 0 else False
# is_multiday == False but that's wrong
anufrievroman commented 9 months ago

Latest changes to timezone conversions introduced an issue:

datetime.date(2023, 1, 1).astimezone  # AttributeError: 'datetime.date' object has no attribute 'astimezone'

Does this happen when some events in .ics have no timezone or it's something else?

Furthermore multiday event does not mean the time difference is larger than 1 day.

I see, I thought datetime implemented the difference operator in a smarter way, then will need to remake it...

anufrievroman commented 9 months ago

Latest changes to timezone conversions introduced an issue:

datetime.date(2023, 1, 1).astimezone  # AttributeError: 'datetime.date' object has no attribute 'astimezone'

The commit d74fcc1ff0ad8d99ac33ef32197a9381540116e9 seems to fix the issue with events without timezone.

anufrievroman commented 9 months ago

Almost woks except for events set as all day. It looks like when start/end time is written in "all day" format as:

DTSTART;VALUE=DATE:20231107

something breaks as compared to the format when time is set:

DTSTART;TZID=Europe/Istanbul:20231114T100000

Which is weird since date is actually parsed correctly...

anufrievroman commented 9 months ago

I think now I finally made it work, please test.

p.s. on the side note, I noticed a strange thing in Nextcloud calendar: all day multiday events export as one day more than they should. Maybe we should report it if it's not my mistake...

jose1711 commented 9 months ago

p.s. on the side note, I noticed a strange thing in Nextcloud calendar: all day multiday events export as one day more than they should. Maybe we should report it if it's not my mistake...

I believe the answer is in rfc5545 - Internet Calendaring and Scheduling Core Object Specification (iCalendar):

The "DTSTART" property for a "VEVENT" specifies the inclusive
start of the event.  For recurring events, it also specifies the
very first instance in the recurrence set.  The "DTEND" property
for a "VEVENT" calendar component specifies the non-inclusive end
of the event.
..
..
The following is an example of the "VEVENT" calendar component
used to represent a multi-day event scheduled from June 28th, 2007
to July 8th, 2007 inclusively.  Note that the "DTEND" property is
set to July 9th, 2007, since the "DTEND" property specifies the
non-inclusive end of the event.

  BEGIN:VEVENT
  UID:20070423T123432Z-541111@example.com
  DTSTAMP:20070423T123432Z
  DTSTART;VALUE=DATE:20070628
  DTEND;VALUE=DATE:20070709
  SUMMARY:Festival International de Jazz de Montreal
  TRANSP:TRANSPARENT
  END:VEVENT
anufrievroman commented 9 months ago

I believe the answer is in rfc5545 - Internet Calendaring and Scheduling Core Object Specification (iCalendar):

Indeed, there is this feature that all day events are written as +1 day sort of, I think I fixed it in e3787ed3cdb8ce558f4bc1b5dcd157f79d808a1d Please try the main branch if you have time.

anufrievroman commented 9 months ago

I'll assume that it works well for everybody and close this issue. If any troubles, you can mention it in #4