
* [CAL-770] add new integration architecture revamp * Type fixes * Type fixes * [CAL-770] Remove tsconfig.tsbuildinfo * [CAL-770] add integration test * Improve google calendar test integration * Remove console.log * Change response any to void in the deleteEvent method * Remove unnecesary const * Add tsconfig.tsbuildinfo to the .gitignore * Remove process env variables as const Co-authored-by: Edward Fernández <edwardfernandez@Edwards-Mac-mini.local> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> Co-authored-by: zomars <zomars@me.com> Co-authored-by: Edward Fernandez <edward.fernandez@rappi.com>
16 lines
548 B
TypeScript
16 lines
548 B
TypeScript
import dayjs from "dayjs";
|
|
import { Attendee, DateArray, DurationObject, Person } from "ics";
|
|
|
|
export const convertDate = (date: string): DateArray =>
|
|
dayjs(date)
|
|
.utc()
|
|
.toArray()
|
|
.slice(0, 6)
|
|
.map((v, i) => (i === 1 ? v + 1 : v)) as DateArray;
|
|
|
|
export const getDuration = (start: string, end: string): DurationObject => ({
|
|
minutes: dayjs(end).diff(dayjs(start), "minute"),
|
|
});
|
|
|
|
export const getAttendees = (attendees: Person[]): Attendee[] =>
|
|
attendees.map(({ email, name }) => ({ name, email, partstat: "NEEDS-ACTION" }));
|