mirror of
https://github.com/ajnart/homarr.git
synced 2026-01-30 11:19:12 +01:00
fix(nextcloud): correct calendar event date mapping and support showU… (#3330)
Co-authored-by: Meier Lukas <meierschlumpf@gmail.com>
This commit is contained in:
@@ -1,6 +1,3 @@
|
||||
import dayjs from "dayjs";
|
||||
import objectSupport from "dayjs/plugin/objectSupport";
|
||||
import utc from "dayjs/plugin/utc";
|
||||
import * as ical from "node-ical";
|
||||
import { DAVClient } from "tsdav";
|
||||
import type { Dispatcher, RequestInit as UndiciFetchRequestInit } from "undici";
|
||||
@@ -15,9 +12,6 @@ import { Integration } from "../base/integration";
|
||||
import type { TestingResult } from "../base/test-connection/test-connection-service";
|
||||
import type { CalendarEvent } from "../calendar-types";
|
||||
|
||||
dayjs.extend(utc);
|
||||
dayjs.extend(objectSupport);
|
||||
|
||||
@HandleIntegrationErrors([integrationTsdavHttpErrorHandler])
|
||||
export class NextcloudIntegration extends Integration {
|
||||
protected async testingAsync(input: IntegrationTestingInput): Promise<TestingResult> {
|
||||
@@ -27,7 +21,7 @@ export class NextcloudIntegration extends Integration {
|
||||
return { success: true };
|
||||
}
|
||||
|
||||
public async getCalendarEventsAsync(start: Date, end: Date): Promise<CalendarEvent[]> {
|
||||
public async getCalendarEventsAsync(start: Date, end: Date, _showUnmonitored?: boolean): Promise<CalendarEvent[]> {
|
||||
const client = await this.createCalendarClientAsync();
|
||||
await client.login();
|
||||
|
||||
@@ -57,14 +51,7 @@ export class NextcloudIntegration extends Integration {
|
||||
|
||||
logger.debug(`Converting VEVENT event to ${event.etag} from Nextcloud: ${JSON.stringify(veventObject)}`);
|
||||
|
||||
const date = dayjs.utc({
|
||||
days: veventObject.start.getDay(),
|
||||
month: veventObject.start.getMonth(),
|
||||
year: veventObject.start.getFullYear(),
|
||||
hours: veventObject.start.getHours(),
|
||||
minutes: veventObject.start.getMinutes(),
|
||||
seconds: veventObject.start.getSeconds(),
|
||||
});
|
||||
const date = veventObject.start;
|
||||
|
||||
const eventUrlWithoutHost = new URL(event.url).pathname;
|
||||
const dateInMillis = veventObject.start.valueOf();
|
||||
@@ -75,7 +62,7 @@ export class NextcloudIntegration extends Integration {
|
||||
|
||||
return {
|
||||
name: veventObject.summary,
|
||||
date: date.toDate(),
|
||||
date,
|
||||
subName: "",
|
||||
description: veventObject.description,
|
||||
links: [
|
||||
|
||||
Reference in New Issue
Block a user