obsidian-community / obsidian-full-calendar

Keep events and manage your calendar alongside all your other notes in your Obsidian Vault.
https://davish.github.io/obsidian-full-calendar/
MIT License
755 stars 96 forks source link

Cannot sync 2nd calendar from Nextcloud CalDav #492

Open brandons209 opened 11 months ago

brandons209 commented 11 months ago

Please check that this issue hasn't been reported before.

Expected Behavior

All calendars sync properly from Nextcloud CalDav calendars.

Current behaviour

My main calendar syncs fine, but the second calendar does not sync and gives an error.

JavaScript console output

plugin:obsidian-full-calendar:64715 Revalidation failed with reason: TypeError: Cannot read properties of null (reading 'getFirstValue') eval @ plugin:obsidian-full-calendar:64715

Steps to reproduce

  1. Add caldav link for nextcloud
  2. All calendars show up properly, click save
  3. Second calendar does not sync

Calendar information

Nextcloud 25.0.2 Calendar App version 4.4.4

Self hosted instance, all other CalDav syncs work as expected.

Which Operating Systems are you using?

Obsidian Version

1.3.7

Full Calendar Plugin Version

0.10.7

Checks

Possible solution

Not sure why the first calendar is able to sync and this one gives an error. I guess some value is not being fetched properly.

Comments

All other calendar sources work fine except this one, including another calendar from the same CalDav link and other ICS calendars.

bepolymathe commented 10 months ago

I have the same problem.

Sinns commented 7 months ago

Me too

pm64 commented 5 months ago

I'm seeing this as well in my testing (exact same error), but with a private Google Calendar ICS link.

@davish, should I try to debug this, or are you already aware of the cause?

UPDATE: on the off chance it was related, I tried swapping in main.js from https://github.com/davish/obsidian-full-calendar/pull/470 -- unfortunately, this had no effect.

jreus commented 5 months ago

I'm having the same issue. Both with a Nextcloud CalDav calendar and with a private Google ICS link. Seems hit or miss whether my calendars will sync or not!

maybe-hello-world commented 2 weeks ago

The same issue with the first private Google Calendar ICS link. The public is working. In particular. the issue is happening when one of the events fails to convert with icsToOFC: https://github.com/obsidian-community/obsidian-full-calendar/blob/b5a7986ad432a23937eaed2d1c520db2643061c2/src/calendars/parsing/ics.ts#L124

Update: a possible reason is that the function isRecurring defined in the compiled code as:

        isRecurring: function() {
          var comp = this.component;
          return comp.hasProperty("rrule") || comp.hasProperty("rdate");
        }

(not sure where it comes exactly from)

while later it is used like this: https://github.com/obsidian-community/obsidian-full-calendar/blob/b5a7986ad432a23937eaed2d1c520db2643061c2/src/calendars/parsing/ics.ts#L35-L38

As a result, on an event with rdate but no rrule it breaks because it's parsed as recurrent but doesn't have rrule property.

Hotfix: open compiled plugin code (main.js), find return comp.hasProperty("rrule") || comp.hasProperty("rdate"); and change to return comp.hasProperty("rrule");. After this change, the private calendar is correctly integrated. No idea what it breaks, I'm not a JS developer ¯\(ツ)