mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
fix: date filter modal selection (#3913)
This commit is contained in:
parent
cc069b61aa
commit
b07fec533c
@ -44,7 +44,10 @@ export const DateFilterModal: React.FC<Props> = ({ title, handleClose, isOpen, o
|
|||||||
handleClose();
|
handleClose();
|
||||||
};
|
};
|
||||||
|
|
||||||
const isInvalid = watch("filterType") === "range" ? new Date(watch("date1")) > new Date(watch("date2")) : false;
|
const date1 = watch("date1");
|
||||||
|
const date2 = watch("date2");
|
||||||
|
|
||||||
|
const isInvalid = watch("filterType") === "range" ? new Date(date1) > new Date(date2) : false;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Transition.Root show={isOpen} as={Fragment}>
|
<Transition.Root show={isOpen} as={Fragment}>
|
||||||
@ -91,7 +94,10 @@ export const DateFilterModal: React.FC<Props> = ({ title, handleClose, isOpen, o
|
|||||||
<DayPicker
|
<DayPicker
|
||||||
selected={value ? new Date(value) : undefined}
|
selected={value ? new Date(value) : undefined}
|
||||||
defaultMonth={value ? new Date(value) : undefined}
|
defaultMonth={value ? new Date(value) : undefined}
|
||||||
onSelect={(date) => onChange(date)}
|
onSelect={(date) => {
|
||||||
|
if (!date) return;
|
||||||
|
onChange(date);
|
||||||
|
}}
|
||||||
mode="single"
|
mode="single"
|
||||||
disabled={[{ after: new Date(watch("date2")) }]}
|
disabled={[{ after: new Date(watch("date2")) }]}
|
||||||
className="border border-custom-border-200 p-3 rounded-md"
|
className="border border-custom-border-200 p-3 rounded-md"
|
||||||
@ -106,7 +112,10 @@ export const DateFilterModal: React.FC<Props> = ({ title, handleClose, isOpen, o
|
|||||||
<DayPicker
|
<DayPicker
|
||||||
selected={value ? new Date(value) : undefined}
|
selected={value ? new Date(value) : undefined}
|
||||||
defaultMonth={value ? new Date(value) : undefined}
|
defaultMonth={value ? new Date(value) : undefined}
|
||||||
onSelect={(date) => onChange(date)}
|
onSelect={(date) => {
|
||||||
|
if (!date) return;
|
||||||
|
onChange(date);
|
||||||
|
}}
|
||||||
mode="single"
|
mode="single"
|
||||||
disabled={[{ before: new Date(watch("date1")) }]}
|
disabled={[{ before: new Date(watch("date1")) }]}
|
||||||
className="border border-custom-border-200 p-3 rounded-md"
|
className="border border-custom-border-200 p-3 rounded-md"
|
||||||
|
Loading…
Reference in New Issue
Block a user