diff --git a/app/(api)/api/calendar/[ownerId]/[projectId]/route.ts b/app/(api)/api/calendar/[ownerId]/[projectId]/route.ts index 82b72bd..8116188 100644 --- a/app/(api)/api/calendar/[ownerId]/[projectId]/route.ts +++ b/app/(api)/api/calendar/[ownerId]/[projectId]/route.ts @@ -1,17 +1,10 @@ import { calendarEvent, project, task, taskList } from "@/drizzle/schema"; import { getUser } from "@/lib/ops/auth"; import { getDatabaseForOwner } from "@/lib/utils/useDatabase"; -import { getVtimezoneComponent } from "@touch4it/ical-timezones"; -import dayjs from "dayjs"; -import tz from "dayjs/plugin/timezone"; -import utc from "dayjs/plugin/utc"; import { and, desc, eq, lte } from "drizzle-orm"; import ical, { ICalCalendarMethod } from "ical-generator"; import type { NextRequest } from "next/server"; -dayjs.extend(utc); -dayjs.extend(tz); - export const revalidate = 0; export const dynamic = "force-dynamic"; @@ -67,20 +60,17 @@ export async function GET( const calendar = ical({ name: projectDetails.name, method: ICalCalendarMethod.PUBLISH, - timezone: timezone - ? { name: timezone, generator: getVtimezoneComponent } - : null, }); for (const event of events) { calendar.createEvent({ id: event.id, start: timezone - ? dayjs.utc(event.start).tz(timezone).format("YYYY-MM-DDTHH:mm:ssZ") + ? event.start.toLocaleString("en-US", { timeZone: timezone }) : event.start, end: event.end ? timezone - ? dayjs.utc(event.end).tz(timezone).format("YYYY-MM-DDTHH:mm:ssZ") + ? event.end.toLocaleString("en-US", { timeZone: timezone }) : event.end : null, summary: event.name, @@ -105,10 +95,10 @@ export async function GET( calendar.createEvent({ id: task.id, start: timezone - ? dayjs.utc(task.dueDate).tz(timezone).format("YYYY-MM-DDTHH:mm:ssZ") + ? task.dueDate.toLocaleString("en-US", { timeZone: timezone }) : task.dueDate, end: timezone - ? dayjs.utc(task.dueDate).tz(timezone).format("YYYY-MM-DDTHH:mm:ssZ") + ? task.dueDate.toLocaleString("en-US", { timeZone: timezone }) : task.dueDate, summary: `[${tasklist.name}] ${task.name}`, description: task.description, diff --git a/package.json b/package.json index 343856d..267e0ef 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,6 @@ "@radix-ui/react-separator": "^1.1.0", "@radix-ui/react-slot": "^1.1.0", "@radix-ui/react-switch": "^1.1.0", - "@touch4it/ical-timezones": "^1.9.0", "autoprefixer": "10.4.14", "better-sqlite3": "^11.7.0", "class-variance-authority": "^0.6.1", @@ -42,7 +41,7 @@ "drizzle-orm": "^0.38.2", "easymde": "^2.18.0", "eslint-config-next": "15.1.0", - "ical-generator": "^8.0.0", + "ical-generator": "^8.0.1", "lucide-react": "^0.244.0", "mime-types": "^2.1.35", "next": "15.1.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 01a7ddc..1640880 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -69,9 +69,6 @@ importers: '@radix-ui/react-switch': specifier: ^1.1.0 version: 1.1.0(@types/react-dom@19.0.2(@types/react@19.0.1))(@types/react@19.0.1)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) - '@touch4it/ical-timezones': - specifier: ^1.9.0 - version: 1.9.0 autoprefixer: specifier: 10.4.14 version: 10.4.14(postcss@8.4.23) @@ -103,8 +100,8 @@ importers: specifier: 15.1.0 version: 15.1.0(eslint@9.13.0(jiti@1.21.6))(typescript@5.7.2) ical-generator: - specifier: ^8.0.0 - version: 8.0.0(@touch4it/ical-timezones@1.9.0)(@types/node@20.1.0)(dayjs@1.11.12)(rrule@2.8.1) + specifier: ^8.0.1 + version: 8.0.1(@touch4it/ical-timezones@1.9.0)(@types/node@20.1.0)(dayjs@1.11.12)(rrule@2.8.1) lucide-react: specifier: ^0.244.0 version: 0.244.0(react@19.0.0) @@ -3185,8 +3182,8 @@ packages: html-url-attributes@3.0.1: resolution: {integrity: sha512-ol6UPyBWqsrO6EJySPz2O7ZSr856WDrEzM5zMqp+FJJLGMW35cLYmmZnl0vztAZxRUoNZJFTCohfjuIJ8I4QBQ==} - ical-generator@8.0.0: - resolution: {integrity: sha512-CvVKK3JJrKop6z7i7/NS69FjYdR6ux1LswIeiZ3yaicX7ocMFLQI475JhQabCT7koUkaCVFNVxLaYaxtdPgwww==} + ical-generator@8.0.1: + resolution: {integrity: sha512-D7D0HPdjg8dEVTyN3QM95sioJj5/6TPj9wetrpt16tzszVgTIXHSSlreTsLuSSQpF61EdVxxTwYS9TVWr7vF0g==} engines: {node: 18 || 20 || >=22.0.0} peerDependencies: '@touch4it/ical-timezones': '>=1.6.0' @@ -6852,7 +6849,8 @@ snapshots: '@tanstack/virtual-core@3.8.4': {} - '@touch4it/ical-timezones@1.9.0': {} + '@touch4it/ical-timezones@1.9.0': + optional: true '@types/better-sqlite3@7.6.12': dependencies: @@ -8066,7 +8064,7 @@ snapshots: html-url-attributes@3.0.1: {} - ical-generator@8.0.0(@touch4it/ical-timezones@1.9.0)(@types/node@20.1.0)(dayjs@1.11.12)(rrule@2.8.1): + ical-generator@8.0.1(@touch4it/ical-timezones@1.9.0)(@types/node@20.1.0)(dayjs@1.11.12)(rrule@2.8.1): dependencies: uuid-random: 1.3.2 optionalDependencies: