Skip to content

Commit

Permalink
DatePicker: Pass options & event in callback too
Browse files Browse the repository at this point in the history
  • Loading branch information
rushi committed Oct 22, 2021
1 parent c6509de commit a4bdc5c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/components/DatePicker/DatePicker.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,17 @@ export const DatePicker = ({
onMonthChange?.(currentMonth);
}, [currentMonth, onMonthChange]);

const handleDayClick = (day) => {
const handleDayClick = (day, options, event) => {
if (isRangeVariant) {
if (value.from && value.to) {
// This allows us to easily select another date range,
// if both dates are selected.
onChange({ from: day, to: null });
onChange({ from: day, to: null }), options, event;
} else {
onChange(DateUtils.addDayToRange(day, value));
onChange(DateUtils.addDayToRange(day, value), options, event);
}
} else {
onChange(day);
onChange(day, options, event);
}
};

Expand Down

0 comments on commit a4bdc5c

Please sign in to comment.