Skip to content

fix(ics): interpret event times with local time zone instead of UTC #589

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

timkicker
Copy link

Previously, ICS events were always parsed in UTC, ignoring TZID/timezone info. This caused events to appear at incorrect times in non-UTC time zones. This patch uses Luxon’s fromJSDate() to respect local time zones.

Test coverage

  • All-day events
  • UTC events
  • Recurring events with TZID

Previously, ICS events were always parsed in UTC, ignoring TZID/timezone info. This caused events to appear at incorrect times in non-UTC time zones.

Fixes obsidian-community#580
@rsomonte
Copy link

How can I test this out? I don't have much experience in GitHub

Copy link

@FyorDev FyorDev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works, fixes my faulty date offset.

I got tired of the wrong time offsets and for the time being applied this patch dirty to .obsidian/plugins/obsidian-full-calendar/main.js until it's merged.
With

function getDate2(t3) {
  return DateTime2.fromJSDate(t3.toJSDate()).toISODate();
}

and

function getTime3(t3) {
  if (t3.isDate) {
    return "00:00";
  }
  return DateTime2.fromJSDate(t3.toJSDate()).toFormat("HH:mm");
}

At

// src/calendars/parsing/ics.ts

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

Successfully merging this pull request may close these issues.

4 participants