cloud-atlas-ai / obsidian-ics

Generate Daily Planner from ical feeds
MIT License
139 stars 27 forks source link

Some recurring events appear with incorrect time #75

Closed kfitz closed 11 months ago

kfitz commented 11 months ago

This may be Outlook 365-specific, but I have several recurring events whose times are being parsed incorrectly. I have a daily calendar block from 8:00 to 10:00am, which winds up appearing at 9:00am in my note. I also have a weekly call on Fridays at 10:00am that persists in appearing at 9:00am. I thought that latter error might have been due to my having created the event when I was located in Central time (I'm now in Eastern time), but that doesn't explain the first error.

In the event it's relevant, I'm using Templater code to pull events in on daily note creation, like so:

<%*
var events = await app.plugins.getPlugin('ics').getEvents(tp.file.title);
var mdArray = [];
events.sort((a,b) => a.utime - b.utime).forEach((e) => {
  const callUrl = e.callUrl? ` [${e.callType}](${e.callUrl})` : '';
  tR+=`- ${e.time} -- ${e.summary} ${callUrl}\n`
})
%>
muness commented 11 months ago

Thanks for the bug report. I see some similar issues (#71). To address these, I am simplifying the way I match events (#72). What I've seen during development is that timezones are a pain. ;)

As I type this out I think I should include the timezone in the output to better test my hypothesis that they're the culprit because to your point, some of the issues don't seem to be TZ related.

kfitz commented 11 months ago

Time zones are indeed a pain. Can't wait to see what the end of daylight saving time does! :)

I can confirm now that time zones were the culprit on the weekly recurring meeting. I canceled it and rescheduled it and now it pulls in at the right time.

Deleting and recreating the daily event didn't help, unfortunately. I also thought perhaps it might be getting shifted to 9am because Outlook's "work hours" setting has my day start at 9 -- but I changed it to 8 and my 8:00-10:00 still shows up as 9:00-11:00.

muness commented 11 months ago

@kfitz : I just merged #72 . Would you check to see if that addresses the issue you're seeing? 🤞

kfitz commented 11 months ago

Unfortunately, no -- that event is stubbornly appearing at 9am instead of 8am. This is the templater code I'm using:

<%*
var events = await app.plugins.getPlugin('ics').getEvents(tp.file.title);
var mdArray = [];
events.sort((a,b) => a.utime - b.utime).forEach((e) => {
  const callUrl = e.callUrl? ` [${e.callType}](${e.callUrl})` : '';
  tR+=`- ${e.time} -- ${e.summary} ${callUrl}\n`
})
%>

Is there anything I need to change based on the plugin updates?

muness commented 11 months ago

Is there anything I need to change based on the plugin updates?

No, I do my best to make new release not require the user to do anything other than update.

Can you try adding the date and timezone, so we can see what's going on with this event? time format: YYYY-MM-DD hh:mmaZ for example adds both and may give us what we need if this is indeed a timezone bug.

Thanks!

kfitz commented 11 months ago

Hmmm. Using that format produces correct dates, and correct time zones (-04:00), but the time of that one daily event is still incorrect. (I also just noticed that events that have been canceled and removed from my calendar are also being pulled in. Which again makes me suspect an O365 issue.)

muness commented 11 months ago

Thanks for checking! Please let me know if you see other similar issues. I'll leave this open for now until I get a week of events in without issue (one can hope!)

muness commented 11 months ago

I've had great luck this week with every event (60?! Yikes) all came in correctly, so I think #72 did the trick.

kfitz commented 11 months ago

Sooooo! The clocks changed overnight, and this morning that daily recurring event pulled in at the correct time! The event series in my O365 calendar begins on a day in standard time (UTC-5) and so even though Outlook corrects for daylight saving time (UTC-4) and passes that information appropriately, it's passing the unshifted time. Or something.