Skip to content

Commit 9949105

Browse files
- don't set workingParts when adjacentDay is select;
- simplify logic to use a targetValue const;
1 parent 354296e commit 9949105

File tree

1 file changed

+17
-22
lines changed

1 file changed

+17
-22
lines changed

core/src/components/datetime/datetime.tsx

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2380,39 +2380,34 @@ export class Datetime implements ComponentInterface {
23802380
return;
23812381
}
23822382

2383-
this.setWorkingParts({
2384-
...this.workingParts,
2383+
const targetValue = {
23852384
month: _month,
23862385
day,
23872386
year: _year,
23882387
isAdjacentDay,
2389-
});
2388+
};
23902389

23912390
if (isAdjacentDay) {
23922391
// The user selected a day outside the current month. Ignore this button, as the month will be re-rendered.
23932392
this.el.blur();
2394-
this.animateToDate(this.workingParts);
2395-
}
23962393

2397-
// multiple only needs date info, so we can wipe out other fields like time
2398-
if (multiple) {
2399-
this.setActiveParts(
2400-
{
2401-
month: _month,
2402-
day,
2403-
year: _year,
2404-
isAdjacentDay,
2405-
},
2406-
isActive
2407-
);
2394+
this.activeParts = targetValue;
2395+
this.animateToDate(targetValue);
24082396
} else {
2409-
this.setActiveParts({
2410-
...activePart,
2411-
month: _month,
2412-
day,
2413-
year: _year,
2414-
isAdjacentDay,
2397+
this.setWorkingParts({
2398+
...this.workingParts,
2399+
...targetValue,
24152400
});
2401+
2402+
// multiple only needs date info, so we can wipe out other fields like time
2403+
if (multiple) {
2404+
this.setActiveParts(targetValue, isActive);
2405+
} else {
2406+
this.setActiveParts({
2407+
...activePart,
2408+
...targetValue,
2409+
});
2410+
}
24162411
}
24172412
}}
24182413
>

0 commit comments

Comments
 (0)