Skip to content

Commit

Permalink
refactor: logic of autoSelection
Browse files Browse the repository at this point in the history
  • Loading branch information
tewarig committed Mar 11, 2025
1 parent 2c3bd83 commit a001647
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/blade/src/components/DatePicker/Calendar.web.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,11 @@ const Calendar = <Type extends DateSelectionType>({
if (_date) {
return _date;
}
if (Array.isArray(oldValue) && oldValue[0]) {
const isRangeSelection = Array.isArray(oldValue);
if (isRangeSelection && oldValue[0]) {
return oldValue[0];
}
if (!Array.isArray(oldValue) && oldValue) {
if (!isRangeSelection && oldValue) {
return oldValue;
}
return shiftTimezone('add', new Date());
Expand Down

0 comments on commit a001647

Please sign in to comment.