Skip to content

Commit

Permalink
set initial values on datepicker outside click
Browse files Browse the repository at this point in the history
  • Loading branch information
SemenStruchev committed Nov 21, 2023
1 parent d760cc4 commit eaa1b6f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion 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 @@ -41,8 +42,10 @@ export const DatePickerPopover = ({
onChange?.(value);
setIsVisible(false);
};

const handleClickOutside = () => {
if (!value?.to) {
onChange(initialValue);
}
toggleVisibility();

Check failure on line 49 in src/components/DatePicker/DatePickerPopover.jsx

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

src/components/DatePicker/DatePickerPopover.jsx#L49

[padding-line-between-statements] Expected blank line before this statement.
};

Check failure on line 50 in src/components/DatePicker/DatePickerPopover.jsx

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

src/components/DatePicker/DatePickerPopover.jsx#L45-L50

[padding-line-between-statements] Expected blank line before this statement.

Expand Down

0 comments on commit eaa1b6f

Please sign in to comment.