diff --git a/src/components/NewUI/EventCreator.tsx b/src/components/NewUI/EventCreator.tsx index 21244d4..2b1a2f0 100644 --- a/src/components/NewUI/EventCreator.tsx +++ b/src/components/NewUI/EventCreator.tsx @@ -108,12 +108,16 @@ export default function EventCreator({ group }: { group: IGroup }) { const [daysOfWeek, setDaysOfWeek] = useState(0); const [endDate, setEndDate] = useState(null); + const durationIsNegative = + endTime && startTime && endTime.getTime() < startTime.getTime(); + const buttonEnabled = name.length > 0 && startTime != null && endTime != null && placeId != null && (!recurring || daysOfWeek || endDate !== null) && + !durationIsNegative && !creating; const createEvent = useCallback(() => { @@ -200,6 +204,11 @@ export default function EventCreator({ group }: { group: IGroup }) { )} + {durationIsNegative && ( + + The start time can't be after the end time. + + )} {createdEventId === -1 ? (