Fixes #347 & some other minor things when timezones differ

This commit is contained in:
Alex van Andel committed 2021-07-08 21:14:29 +00:00
1 parent ffd99d02bb
commit be102b1b09
4 files changed
+28 -8

No files matched your search

+17 -2
View File
@@ -3,10 +3,25 @@ import { useRouter } from "next/router";
import Slots from "./Slots";
import { ExclamationIcon } from "@heroicons/react/solid";
const AvailableTimes = ({ date, eventLength, eventTypeId, workingHours, timeFormat, user }) => {
const AvailableTimes = ({
date,
eventLength,
eventTypeId,
workingHours,
timeFormat,
user,
organizerTimeZone,
}) => {
const router = useRouter();
const { rescheduleUid } = router.query;
const { slots, isFullyBooked, hasErrors } = Slots({ date, eventLength, workingHours });
const { slots, isFullyBooked, hasErrors } = Slots({
date,
eventLength,
workingHours,
organizerTimeZone,
});
return (
<div className="sm:pl-4 mt-8 sm:mt-0 text-center sm:w-1/3 md:max-h-97 overflow-y-auto">
<div className="text-gray-600 font-light text-xl mb-4 text-left">
+5 -4
View File
@@ -1,10 +1,9 @@
import { useEffect, useState } from "react";
import { useState, useEffect } from "react";
import { useRouter } from "next/router";
import getSlots from "../../lib/slots";
import dayjs, { Dayjs } from "dayjs";
import isBetween from "dayjs/plugin/isBetween";
import utc from "dayjs/plugin/utc";
dayjs.extend(isBetween);
dayjs.extend(utc);
@@ -12,9 +11,11 @@ type Props = {
eventLength: number;
minimumBookingNotice?: number;
date: Dayjs;
workingHours: [];
organizerTimeZone: string;
};
const Slots = ({ eventLength, minimumBookingNotice, date, workingHours, organizerUtcOffset }: Props) => {
const Slots = ({ eventLength, minimumBookingNotice, date, workingHours, organizerTimeZone }: Props) => {
minimumBookingNotice = minimumBookingNotice || 0;
const router = useRouter();
@@ -48,7 +49,7 @@ const Slots = ({ eventLength, minimumBookingNotice, date, workingHours, organize
inviteeDate: date,
workingHours,
minimumBookingNotice,
organizerUtcOffset,
organizerTimeZone,
});
const timesLengthBeforeConflicts: number = times.length;