fixed calendso busy query timezone issue (#1360)
* fixed calendso busy query timezone issue * rename tz to timezone for consistency * added back missing code Co-authored-by: Alex van Andel <me@alexvanandel.com> Co-authored-by: Peer Richelsen <peeroke@gmail.com> Co-authored-by: Omar López <zomars@me.com> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
parent
a41dd30467
commit
7f5a2363f9
1 changed files with 7 additions and 2 deletions
|
@ -1,5 +1,7 @@
|
|||
import { Credential } from "@prisma/client";
|
||||
import dayjs from "dayjs";
|
||||
import timezone from "dayjs/plugin/timezone";
|
||||
import utc from "dayjs/plugin/utc";
|
||||
import ICAL from "ical.js";
|
||||
import { createEvent } from "ics";
|
||||
import {
|
||||
|
@ -24,6 +26,9 @@ import { CalendarEventType, EventBusyDate, NewCalendarEventType } from "../const
|
|||
import { Calendar, CalendarEvent, IntegrationCalendar } from "../interfaces/Calendar";
|
||||
import { convertDate, getAttendees, getDuration } from "../utils/CalendarUtils";
|
||||
|
||||
dayjs.extend(utc);
|
||||
dayjs.extend(timezone);
|
||||
|
||||
const CALENDSO_ENCRYPTION_KEY = process.env.CALENDSO_ENCRYPTION_KEY || "";
|
||||
|
||||
export default abstract class BaseCalendarService implements Calendar {
|
||||
|
@ -291,11 +296,11 @@ export default abstract class BaseCalendarService implements Calendar {
|
|||
vcalendar.getFirstSubcomponent("vtimezone")?.getFirstPropertyValue("tzid") || "";
|
||||
|
||||
const startDate = calendarTimezone
|
||||
? dayjs(event.startDate.toJSDate()).tz(calendarTimezone)
|
||||
? dayjs.tz(event.startDate.toString(), calendarTimezone)
|
||||
: new Date(event.startDate.toUnixTime() * 1000);
|
||||
|
||||
const endDate = calendarTimezone
|
||||
? dayjs(event.endDate.toJSDate()).tz(calendarTimezone)
|
||||
? dayjs.tz(event.endDate.toString(), calendarTimezone)
|
||||
: new Date(event.endDate.toUnixTime() * 1000);
|
||||
|
||||
return {
|
||||
|
|
Loading…
Reference in a new issue