Skip to content

Scheduling infrastructure for absolutely everyone.

Fixes UTC issue to success page when refreshed

Alex van Andel6b38fd75505b
diff --git a/pages/success.tsx b/pages/success.tsx
index 0451806d2c4..c60f2a1ce02 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) {
<title>Booking Confirmed | {props.eventType.title} with {props.user.name || props.user.username} | Calendso</title>
<link rel="icon" href="/favicon.ico" />
</Head>
-
<main className="max-w-3xl mx-auto my-24">
<div className="fixed z-10 inset-0 overflow-y-auto">
<div className="flex items-end justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0">
@@ -148,4 +150,4 @@ export async function getServerSideProps(context) {
eventType
},
}
-}
\ No newline at end of file
+}