feat: cannot set previous dates
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
import { cn } from "@/utils/class-merge";
|
import { cn } from "@/utils/class-merge";
|
||||||
import { ClockIcon } from "@heroicons/react/24/outline";
|
import { ClockIcon } from "@heroicons/react/24/outline";
|
||||||
import { FunctionComponent } from "preact";
|
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 { Calendar, CalendarPassThroughMethodOptions } from "primereact/calendar";
|
||||||
import { FormEvent } from "primereact/ts-helpers";
|
import { FormEvent } from "primereact/ts-helpers";
|
||||||
import Button from "./ui/Button";
|
import Button from "./ui/Button";
|
||||||
@@ -36,6 +36,13 @@ const ModalCalendar: FunctionComponent<ModalCalendarProps> = ({
|
|||||||
...rest
|
...rest
|
||||||
}) => {
|
}) => {
|
||||||
const [showTime, setShowTime] = useState(false);
|
const [showTime, setShowTime] = useState(false);
|
||||||
|
const [minDate, setMinDate] = useState(new Date());
|
||||||
|
useEffect(() => {
|
||||||
|
const interval = setInterval(() => {
|
||||||
|
setMinDate(new Date());
|
||||||
|
}, 1000);
|
||||||
|
return () => clearInterval(interval);
|
||||||
|
}, []);
|
||||||
return (
|
return (
|
||||||
<ModalWindow
|
<ModalWindow
|
||||||
{...rest}
|
{...rest}
|
||||||
@@ -53,6 +60,7 @@ const ModalCalendar: FunctionComponent<ModalCalendarProps> = ({
|
|||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
value={value}
|
value={value}
|
||||||
hourFormat="24"
|
hourFormat="24"
|
||||||
|
minDate={minDate}
|
||||||
showTime={showTime}
|
showTime={showTime}
|
||||||
pt={{
|
pt={{
|
||||||
root: ({ props }: CalendarPassThroughMethodOptions) => ({
|
root: ({ props }: CalendarPassThroughMethodOptions) => ({
|
||||||
|
|||||||
Reference in New Issue
Block a user