diff --git a/src/components/ModalCalendar.tsx b/src/components/ModalCalendar.tsx index b5ea2f1..10f573c 100644 --- a/src/components/ModalCalendar.tsx +++ b/src/components/ModalCalendar.tsx @@ -1,7 +1,7 @@ import { cn } from "@/utils/class-merge"; import { ClockIcon } from "@heroicons/react/24/outline"; import { FunctionComponent } from "preact"; -import { Dispatch, StateUpdater, useState } from "preact/hooks"; +import { Dispatch, StateUpdater, useEffect, useState } from "preact/hooks"; import { Calendar, CalendarPassThroughMethodOptions } from "primereact/calendar"; import { FormEvent } from "primereact/ts-helpers"; import Button from "./ui/Button"; @@ -36,6 +36,13 @@ const ModalCalendar: FunctionComponent = ({ ...rest }) => { const [showTime, setShowTime] = useState(false); + const [minDate, setMinDate] = useState(new Date()); + useEffect(() => { + const interval = setInterval(() => { + setMinDate(new Date()); + }, 1000); + return () => clearInterval(interval); + }, []); return ( = ({ onChange={onChange} value={value} hourFormat="24" + minDate={minDate} showTime={showTime} pt={{ root: ({ props }: CalendarPassThroughMethodOptions) => ({