Fixed bug that kept the date enabled when the time slot was less than 30m

This commit is contained in:
Alex van Andel 2021-06-30 15:41:38 +00:00
parent bfc7cce688
commit a28cb455f1
2 changed files with 10 additions and 2 deletions

View file

@ -7,7 +7,14 @@ import getSlots from "@lib/slots";
dayjs.extend(utc);
dayjs.extend(timezone);
const DatePicker = ({ weekStart, onDatePicked, workingHours, organizerTimeZone, inviteeTimeZone }) => {
const DatePicker = ({
weekStart,
onDatePicked,
workingHours,
organizerTimeZone,
inviteeTimeZone,
eventLength,
}) => {
const [calendar, setCalendar] = useState([]);
const [selectedMonth, setSelectedMonth]: number = useState();
const [selectedDate, setSelectedDate]: Dayjs = useState();
@ -43,7 +50,7 @@ const DatePicker = ({ weekStart, onDatePicked, workingHours, organizerTimeZone,
date.endOf("day").isBefore(dayjs().tz(inviteeTimeZone)) ||
!getSlots({
inviteeDate: date,
frequency: 30,
frequency: eventLength,
workingHours,
organizerTimeZone,
}).length

View file

@ -128,6 +128,7 @@ export default function Type(props): Type {
workingHours={props.workingHours}
organizerTimeZone={props.eventType.timeZone || props.user.timeZone}
inviteeTimeZone={timeZone()}
eventLength={props.eventType.length}
/>
{selectedDate && (
<AvailableTimes