Skip to content

Commit

Permalink
chore: more reliable if/else
Browse files Browse the repository at this point in the history
  • Loading branch information
mirus-ua committed Apr 2, 2024
1 parent c10c079 commit dd7f40c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -692,10 +692,12 @@ export default class DatePicker extends React.Component {
} else if (hasStartRange) {
if (changedDate === null) {
onChange([null, null], event);
} else if (isDateBefore(changedDate, startDate) && swapRange) {
onChange([changedDate, startDate], event);
} else if (isDateBefore(changedDate, startDate)) {
onChange([changedDate, null], event);
if (swapRange) {
onChange([changedDate, startDate], event);
} else {
onChange([changedDate, null], event);
}
} else {
onChange([startDate, changedDate], event);
}
Expand Down

0 comments on commit dd7f40c

Please sign in to comment.