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
780 stars 102 forks source link

ICS events appear in the wrong timezone #311

Open kmaustral opened 1 year ago

kmaustral commented 1 year ago

Describe the bug ICS events are in another time zone than my system setting. It worked before the upgrade to version 0.10.5.

There are no events visible in the Full Note setting, which worked before. There doesn't seem to be an "upgrade" command any more for me to check the event. The Event Reset command worked to surface one event, but that then disappeared after a subsequent reset.

Here are the console errors:

image

rwchan13 commented 1 year ago

Having similar issues. My ICS events seem to be in the wrong time zone but for me both the calendar(google) and desktop are in the same time zone.

davish commented 1 year ago

Hi @kmaustral can you submit a separate ticket for the Full Note issue? They are not related to each other.

malevans commented 1 year ago

Can confirm this is behaving for me as well.

Events in calendar are showing as UTC

kmaustral commented 1 year ago

I hope you're getting good support to fix these problems. I'm really missing this plugin.

rwchan13 commented 1 year ago

I've revert to release 0.9.0. It's a reasonable temporary fix till the bug is solved.

matthewcm commented 1 year ago

Seeing this issue. Times are all 1 hour behind ( Not respecting daylight saving hour ) BST british summer time

Peeeet commented 1 year ago

It would seem Full-Calendar is just putting whatever time is in the DTSTART and DTEND fields from the iCal data stream right into the calendar as if those timestamps are already in the local timezone, but that is not the case. The standard in iCal is to always have the times listed as UTC, hence the "Z" (Zulu timezone) at the end of the timestamp in the DTSTART and DTEND fields:

https://en.wikipedia.org/wiki/ICalendar#Date_and_time_format

I thought maybe Full-Calendar was assuming those times are already in whatever timezone is shown in the "X-WR-TIMEZONE" field of the iCal data stream, but after I changed my timezone in Google Calendar and confirmed that the field changed to "UTC" in the iCal field, nothing changed in Full-Calendar.

So my question is: Should Full-Calendar be attempting to translate the timestamps in iCal feeds from their native UTC format into whatever the local timezone is? (aka is the local timezone being pulled from Obsidian somewhere? or directly from the Operating System?)

If so, maybe is it doing that - but it's just getting incorrect "local time zone" info from Obsidian / the operating system?

Could we just get an option in the Full-Calendar settings screen to force what the local timezone should be AKA what it should translate the iCal UTC times to for display in Obsidian?

Also note - Google Calendar users - if you change the "timezone" setting for a specific single individual event in Google Calendar, it doesn't seem to treat the actual time that you input any differently, and that setting doesn't show up in the iCal feed. AKA you can set that "timezone" to whatever you want, but the time it is showing you is still in your calendar's primary timezone. It seems that "timezone" setting is just for your own meta-data to know where in the world the event is happening, but it's not showing you what the time would be in that timezone? This might be a bug in Google Calendar, hard to tell.

The only way I could get Google to show me anything different is to change the primary timezone of my Google Calendar display (for all calenadrs), or show a second timezone and it would show a timescale for both zones next to eachother on the left in "Day" view, but the times displayed in the events and their locations on the scale were always locked to that primary timezone display setting, never changing for the calendar's timezone or the event's individual timezone settings.

davish commented 1 year ago

Thanks for the writeup @Peeeet. Timezones are currently not supported, and you are correct that DTSTART is passed to the view layer as-is. I'm working on #331 now, which will make it easier to support optional timezones in event info coming from remote calendars. In the code, I even have a TODO where the timezone is pulled out of the ICS file. It's just not plumbed through yet: https://github.com/davish/obsidian-full-calendar/blob/c731dc93ed811b5a356cc3167dbc2d4fcfbdb968/src/calendars/parsing/ics.ts#L100-L102

t-schreibs commented 1 year ago

Reverting to 0.9.5 also works. I'm assuming this bug was introduced in 0.10.0, yeah?

markwmcginnis commented 1 year ago

If it is of any help, I can describe more fully the issue I'm having with the time zone with my google calendar events as it's not quite that they are all appearing in UTC for me.

In short it seems to pull the local time from where the event was created originally and pushes that as the local time for the user (?) Good luck with this -- I only just downloaded the plug-in and really think it will be a huge benefit going forward. Thank you for all the work!

rjpifer commented 1 year ago

I'm seeing the identical issue pulling events from an Outlook calendar.

  • Events created by me or someone in my time zone show up at the correct time.
  • Events created by someone in a different time zone appear as if I were in their time zone. As an example, when a coworker in the west coast of the US creates a meeting for us at 18:00 on a Tuesday, the meeting time shows up as 18:00 Tuesday in my calendar even though it's really meant to be 08:00 Wednesday where I am in Asia. In short it seems to pull the local time from where the event was created originally and pushes that as the local time for the user (?)
erv4gen commented 1 year ago

As a temporal workaround, I noticed that recurring events occur at the correct timezone: So if I want to create a one-time event, I switch from "Doest not repeat" to "Custom" and make it to end at the same day:

image

It's a little bit of a hassle and won't work for events that you are invited to, but it works for me since I use it as a personal task manager and sync events that I create in the Google Calendar.

derseebaer1 commented 1 year ago
  1. Thank you for the very nice and useful plugin @davish!
  2. Are there any news on the issue with the time zones? Will there be an update soon?
Y-a-n-i-n-a commented 1 year ago

Subscribing to follow, same issue with Outlook calendar (but not Google)

jsglazer commented 1 year ago

Subscribing to follow. I experience this bug with native Google and Google Domain calendars. This plugin rocks and will be a critical part of my workflow once the time zone issue is squared away. Thank for building it Davish!

drnola commented 1 year ago

I second jsglazer's comment. Looking forward to a fix.

prgrphnrtr commented 10 months ago

Same Issue here for non-recurring events imported from Google Calendar - I would really appreciate a fix for this great plugin! 👍

petathames commented 9 months ago

Hacky-hack (I'm not proud). If you do this you'll need to make this change again after every upgrade until @davish has time to fix it (ps thank you @davish this is far and away my most useful and practical plugin. Everyone send Davis a coffee.)

Now I've only just changed this, I don't know yet this if this change will break anything else. My non-iCal events are still displaying correctly though so I figure that's a good start. YMMV, I am not responsible etc.

  1. Make a copy of ~/.obsidian/plugins/obsidian-full-calendar/main.js and keep it safe
  2. Edit the original main.js file
  3. Search for function getDate2
  4. In the getDate2 and getTime3 functions, change both instances of "UTC" to your fixed offset timezone, eg mine is "UTC+10" so:
    // src/calendars/parsing/ics.ts
    var import_ical = __toModule(require_ical());
    function getDate2(t3) {
    return DateTime2.fromSeconds(t3.toUnixTime(), { zone: "UTC" }).toISODate();
    }
    function getTime3(t3) {
    if (t3.isDate) {
    return "00:00";
    }
    return DateTime2.fromSeconds(t3.toUnixTime(), { zone: "UTC" }).toISOTime({
    includeOffset: false,
    includePrefix: false,
    suppressMilliseconds: true,
    suppressSeconds: true
    });
    }

    to

    // src/calendars/parsing/ics.ts
    var import_ical = __toModule(require_ical());
    function getDate2(t3) {
    return DateTime2.fromSeconds(t3.toUnixTime(), { zone: "UTC+10" }).toISODate();
    }
    function getTime3(t3) {
    if (t3.isDate) {
    return "00:00";
    }
    return DateTime2.fromSeconds(t3.toUnixTime(), { zone: "UTC+10" }).toISOTime({
    includeOffset: false,
    includePrefix: false,
    suppressMilliseconds: true,
    suppressSeconds: true
    });
    }
  5. Reload or restart Obsidian, boom. In a good way, hopefully.

This essentially hardcodes your base timezone, then the plugin will use that timezone to convert the DTSTART and DTEND UTC fields coming in from ical sources. I don't have enough knowledge in this area to know why the plugin isn't picking up our local/system timezones and setting using it for those calculations the way it did prior to v0.10.

If you do break things catastrophically, move your backup main.js file back into place, or reinstall the plugin.

seansturgess commented 8 months ago

Nice hack @petathames Thank you, @davish for maintaining this great plugin :)

JoFrhwld commented 7 months ago

Thought I'd add an additional datapoint. Maybe one of the two open PRs (#539 or #540) fixes this.

When adding my personal Google Calendar via the private ics link

However, when adding my work Outlook Calendar

Not sure what the difference is between how these two services generate the ics file.

andre-vidal-capon commented 5 months ago

Thought I'd add an additional datapoint. Maybe one of the two open PRs (#539 or #540) fixes this.

When adding my personal Google Calendar via the private ics link

  • Recurring events are in the correct time zone
  • Single events are showing up in UTC

However, when adding my work Outlook Calendar

  • All events appear in the correct time zone

Not sure what the difference is between how these two services generate the ics file.

I'm having exactly the same issue here.

mattwhetton commented 5 months ago

When adding my personal Google Calendar via the private ics link

  • Recurring events are in the correct time zone
  • Single events are showing up in UTC

Exactly the same for me

v-wangg commented 1 month ago

Subscribing to follow as well. This would make a huge difference to my calendar workflow!

punkyard commented 1 week ago

hi, has this thread found a solution yet?

matching obsidian full calendar to system time zone? or add a time zone picker to the plugin?

good work for this plugin.. waiting to try it for good 💪🤤✌️