From dd7f40cff59a035dcf2c23f83b0489a082577cf0 Mon Sep 17 00:00:00 2001 From: Mirus Date: Tue, 2 Apr 2024 11:16:43 +0300 Subject: [PATCH] chore: more reliable if/else --- src/index.jsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/index.jsx b/src/index.jsx index 6839710e2..5168b25d3 100644 --- a/src/index.jsx +++ b/src/index.jsx @@ -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); }