Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add button clear value ion-datetime in ionic

I want create a ion-date time with three button : cancel , done and clear. so I custom in here:

Add button clear data ion-datetime

I want if date is chose I can click Clear in modal date picker to remove value same when click button Clear Data. How I can do it? Thank every one

like image 568
Hoa.Tran Avatar asked Nov 27 '25 19:11

Hoa.Tran


1 Answers

I’m using :

I’ve added a custom button to a ionic-datetime

<ion-datetime
    formControlName="myDateCustom"
    [pickerOptions]="customPickerOption">
</ion-datetime>

and ts.

customPickerOption = {
    buttons: [{
    text: 'Clear',
       handler: () => this.myForm.controls['myDateCustom'].setValue(null)
}]
like image 98
Eber Avatar answered Nov 30 '25 09:11

Eber



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!