(closeOverlay = false)
| 548 | */ |
| 549 | @Method() |
| 550 | async confirm(closeOverlay = false) { |
| 551 | const { isCalendarPicker, activeParts, preferWheel, workingParts } = this; |
| 552 | |
| 553 | /** |
| 554 | * We only update the value if the presentation is not a calendar picker. |
| 555 | */ |
| 556 | if (activeParts !== undefined || !isCalendarPicker) { |
| 557 | const activePartsIsArray = Array.isArray(activeParts); |
| 558 | if (activePartsIsArray && activeParts.length === 0) { |
| 559 | if (preferWheel) { |
| 560 | /** |
| 561 | * If the datetime is using a wheel picker, but the |
| 562 | * active parts are empty, then the user has confirmed the |
| 563 | * initial value (working parts) presented to them. |
| 564 | */ |
| 565 | this.setValue(convertDataToISO(workingParts)); |
| 566 | } else { |
| 567 | this.setValue(undefined); |
| 568 | } |
| 569 | } else { |
| 570 | this.setValue(convertDataToISO(activeParts)); |
| 571 | } |
| 572 | } |
| 573 | |
| 574 | if (closeOverlay) { |
| 575 | this.closeParentOverlay(CONFIRM_ROLE); |
| 576 | } |
| 577 | } |
| 578 | |
| 579 | /** |
| 580 | * Resets the internal state of the datetime but does not update the value. |
no test coverage detected