feat: cannot set previous dates
This commit is contained in:
@@ -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<ModalCalendarProps> = ({
|
||||
...rest
|
||||
}) => {
|
||||
const [showTime, setShowTime] = useState(false);
|
||||
const [minDate, setMinDate] = useState(new Date());
|
||||
useEffect(() => {
|
||||
const interval = setInterval(() => {
|
||||
setMinDate(new Date());
|
||||
}, 1000);
|
||||
return () => clearInterval(interval);
|
||||
}, []);
|
||||
return (
|
||||
<ModalWindow
|
||||
{...rest}
|
||||
@@ -53,6 +60,7 @@ const ModalCalendar: FunctionComponent<ModalCalendarProps> = ({
|
||||
onChange={onChange}
|
||||
value={value}
|
||||
hourFormat="24"
|
||||
minDate={minDate}
|
||||
showTime={showTime}
|
||||
pt={{
|
||||
root: ({ props }: CalendarPassThroughMethodOptions) => ({
|
||||
|
||||
Reference in New Issue
Block a user