From 6b38fd75505b01d312962189058615158f06213b Mon Sep 17 00:00:00 2001 From: Alex van Andel Date: Mon, 10 May 2021 16:35:48 +0000 Subject: [PATCH] Fixes UTC issue to success page when refreshed --- pages/success.tsx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/pages/success.tsx b/pages/success.tsx index 0451806d2c..c60f2a1ce0 100644 --- a/pages/success.tsx +++ b/pages/success.tsx @@ -4,8 +4,11 @@ import prisma from '../lib/prisma'; import { useRouter } from 'next/router'; import { CheckIcon } from '@heroicons/react/outline'; import { ClockIcon, CalendarIcon, LocationMarkerIcon } from '@heroicons/react/solid'; -const dayjs = require('dayjs'); -const ics = require('ics'); +import dayjs from 'dayjs'; +import utc from 'dayjs/plugin/utc'; +import { createEvent } from 'ics'; + +dayjs.extend(utc); export default function Success(props) { const router = useRouter(); @@ -22,7 +25,7 @@ export default function Success(props) { optional['location'] = location; } - const event = ics.createEvent({ + const event = createEvent({ start, startInputType: 'utc', title: props.eventType.title + ' with ' + props.user.name, @@ -44,7 +47,6 @@ export default function Success(props) { Booking Confirmed | {props.eventType.title} with {props.user.name || props.user.username} | Calendso -
@@ -148,4 +150,4 @@ export async function getServerSideProps(context) { eventType }, } -} \ No newline at end of file +}