Skip to content

Commit

Permalink
fix(datetime): add open() method
Browse files Browse the repository at this point in the history
fixes #14923
  • Loading branch information
manucorporat committed Aug 11, 2018
1 parent 4047812 commit f032769
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions core/src/components/datetime/datetime.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, Event, EventEmitter, Prop, State, Watch } from '@stencil/core';
import { Component, Event, EventEmitter, Prop, State, Watch, Method } from '@stencil/core';

import { CssClassMap, PickerColumn, PickerOptions, StyleEvent } from '../../interface';
import { clamp, deferEvent } from '../../utils/helpers';
Expand Down Expand Up @@ -221,6 +221,18 @@ export class Datetime {
this.emitStyle();
}

@Method()
async open() {
if (this.disabled) {
return;
}

const pickerOptions = this.generatePickerOptions();
this.picker = await this.pickerCtrl.create(pickerOptions);
this.validate();
await this.picker.present();
}

private emitStyle() {
this.ionStyle.emit({
'interactive': true,
Expand All @@ -235,18 +247,6 @@ export class Datetime {
this.updateText();
}

private async open() {
if (this.disabled) {
return;
}

const pickerOptions = this.generatePickerOptions();
this.picker = await this.pickerCtrl.create(pickerOptions);

this.validate();
await this.picker!.present();
}

private generatePickerOptions(): PickerOptions {
const pickerOptions: PickerOptions = {
...this.pickerOptions,
Expand Down

0 comments on commit f032769

Please sign in to comment.