mirror of
https://github.com/karl0ss/homepage.git
synced 2025-04-29 12:03:41 +01:00
Enhancement: better tz parsing of ical recurring events (#4749)
This commit is contained in:
parent
f283b83e6e
commit
e46377f461
@ -78,7 +78,16 @@ export default function Integration({ config, params, setEvents, hideErrors, tim
|
|||||||
const rule = new RRule(recurrenceOptions);
|
const rule = new RRule(recurrenceOptions);
|
||||||
const recurringEvents = rule.between(startDate.toJSDate(), endDate.toJSDate());
|
const recurringEvents = rule.between(startDate.toJSDate(), endDate.toJSDate());
|
||||||
|
|
||||||
recurringEvents.forEach((date, i) => eventToAdd(date, i, "recurring"));
|
recurringEvents.forEach((date, i) => {
|
||||||
|
let eventDate = date;
|
||||||
|
if (event.dtstart?.params?.tzid) {
|
||||||
|
// date is in UTC but parsed as if it is in current timezone, so we need to adjust it
|
||||||
|
const dateInUTC = DateTime.fromJSDate(date).setZone("UTC");
|
||||||
|
const offset = dateInUTC.offset - DateTime.fromJSDate(date, { zone: event.dtstart.params.tzid }).offset;
|
||||||
|
eventDate = dateInUTC.plus({ minutes: offset }).toJSDate();
|
||||||
|
}
|
||||||
|
eventToAdd(eventDate, i, "recurring");
|
||||||
|
});
|
||||||
return;
|
return;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
|
Loading…
x
Reference in New Issue
Block a user