fixed multiple caldav integration bugs (#1764)

pull/1360/head
Nathaniel 2022-02-10 01:16:44 +08:00 committed by GitHub
parent 51d553559f
commit b2fb60af31
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 18 deletions

View File

@ -192,7 +192,7 @@ export default abstract class BaseCalendarService implements Calendar {
const objects = (
await Promise.all(
selectedCalendars
.filter((sc) => sc.integration === "caldav_calendar")
.filter((sc) => ["caldav_calendar", "apple_calendar"].includes(sc.integration ?? ""))
.map((sc) =>
fetchCalendarObjects({
calendar: {
@ -216,20 +216,10 @@ export default abstract class BaseCalendarService implements Calendar {
const vcalendar = new ICAL.Component(jcalData);
const vevent = vcalendar.getFirstSubcomponent("vevent");
const event = new ICAL.Event(vevent);
const calendarTimezone =
vcalendar.getFirstSubcomponent("vtimezone")?.getFirstPropertyValue("tzid") || "";
const startDate = calendarTimezone
? dayjs(event.startDate.toJSDate()).tz(calendarTimezone)
: new Date(event.startDate.toUnixTime() * 1000);
const endDate = calendarTimezone
? dayjs(event.endDate.toJSDate()).tz(calendarTimezone)
: new Date(event.endDate.toUnixTime() * 1000);
return {
start: startDate.toISOString(),
end: endDate.toISOString(),
start: event.startDate.toJSDate().toISOString(),
end: event.endDate.toJSDate().toISOString(),
};
});

View File

@ -106,7 +106,7 @@
"short-uuid": "^4.2.0",
"stripe": "^8.191.0",
"superjson": "1.8.0",
"tsdav": "2.0.0-rc.3",
"tsdav": "2.0.0",
"tslog": "^3.2.1",
"uuid": "^8.3.2",
"web3": "^1.6.1",

View File

@ -11363,10 +11363,10 @@ ts-node@^10.2.1:
make-error "^1.1.1"
yn "3.1.1"
tsdav@2.0.0-rc.3:
version "2.0.0-rc.3"
resolved "https://registry.yarnpkg.com/tsdav/-/tsdav-2.0.0-rc.3.tgz#b8cef07079e69a65be4d1404c91a6dbd319fa5b0"
integrity sha512-F6YxPB+dA5TP5KIr4NgfzQtPO7Pvf6XLwDjkpkWw6FhAdtshN97AVR+kP+DPcyUp2df3vMK9YS+XEOcpqwxCCw==
tsdav@2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/tsdav/-/tsdav-2.0.0.tgz#e0a91d0ad79e793885b3fdc34157bd8aeedfb0f1"
integrity sha512-ENdQyhu4T03QZxh5dhoDP7vXB8bqwpBATCA57pu61Gam5/wg+7JApQuUdGjXHGzcqSpWpD960avPCdj2M+hlLQ==
dependencies:
base-64 "1.0.0"
cross-fetch "3.1.5"