Skip to content

Commit

Permalink
X2-7919 set initial values on datepicker outside click (#287)
Browse files Browse the repository at this point in the history
* set initial values on datepicker outside click

* fix lint

* fix minor issue
  • Loading branch information
SemenStruchev authored Nov 22, 2023
1 parent d760cc4 commit b7819f4
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/components/DatePicker/DatePickerPopover.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export const DatePickerPopover = ({
getDayContent,
...rest
}) => {
const [initialValue] = useState(value);
const [originalValue, setOriginalValue] = useState(value);
const [isVisible, setIsVisible] = useState(false);

Expand All @@ -43,6 +44,10 @@ export const DatePickerPopover = ({
};

const handleClickOutside = () => {
if (!value?.to && variant === "range") {
onChange(initialValue);
}

toggleVisibility();
};

Expand Down

0 comments on commit b7819f4

Please sign in to comment.