MCPcopy Index your code
hub / github.com/ionic-team/ionic-framework / confirm

Method confirm

core/src/components/datetime/datetime.tsx:550–577  ·  view source on GitHub ↗
(closeOverlay = false)

Source from the content-addressed store, hash-verified

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.

Callers 6

DatetimeClass · 0.95
renderFooterMethod · 0.95
renderMonthMethod · 0.95
datetime.e2e.tsFile · 0.80
datetime.e2e.tsFile · 0.80
datetime.e2e.tsFile · 0.80

Calls 2

convertDataToISOFunction · 0.90
setValueMethod · 0.45

Tested by

no test coverage detected