Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
jose1711 opened this issue Nov 18, 2023 · 9 comments
Closed

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

jose1711 opened this issue Nov 18, 2023 · 9 comments

Comments

@jose1711
Copy link
Contributor

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
Copy link
Owner

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.

anufrievroman added a commit that referenced this issue Nov 23, 2023
This is initial implementation of multiday events parsing to address issue #68. After this, still need to implement displaying the repeated events.
@jose1711
Copy link
Contributor Author

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
Copy link
Owner

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 added a commit that referenced this issue Nov 24, 2023
@anufrievroman
Copy link
Owner

Latest changes to timezone conversions introduced an issue:

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

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

anufrievroman added a commit that referenced this issue Nov 28, 2023
anufrievroman added a commit that referenced this issue Nov 28, 2023
Resolves issue #68 about displaying multiday events from ics
@anufrievroman
Copy link
Owner

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
Copy link
Owner

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
Copy link
Contributor Author

jose1711 commented Dec 1, 2023

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 added a commit that referenced this issue Dec 2, 2023
@anufrievroman
Copy link
Owner

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 e3787ed Please try the main branch if you have time.

@anufrievroman
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants