this repo has no description

Got rid of eeroneous timezone conversion on UNIX timestamps

+1 -6
+1 -6
routes/api/fetch-calendar-text.ts
··· 1 1 import { Handlers } from "$fresh/server.ts"; 2 2 import { processCalendarRequest } from "../../utils/calendarUtils.ts"; 3 - import { toZonedTime } from "npm:date-fns-tz"; 4 3 5 4 export const handler: Handlers = { 6 5 async GET(req) { ··· 11 10 12 11 let formattedText = ""; 13 12 for (const event of events) { 14 - const startDate = toZonedTime( 15 - new Date(event.start), 16 - event.timezone!, 17 - ); 18 - const unixTimestamp = Math.floor(startDate.getTime() / 1000); 13 + const unixTimestamp = Math.floor(event.start.getTime() / 1000); 19 14 formattedText += 20 15 `\n- <t:${unixTimestamp}:F> | **${event.summary}**`; 21 16 if (event.description) {