Ion-datetime with placeholder and ngModel value in ionic


I am using ion-datetime tag for showing picker in my ionic application. It showing UTC datetime by default and I need a datepicker with specific timezone. So I have done a small piece of code added to get achieve this requirement. I have mentioned my code is given below:

let pickedDate = moment(new Date()).tz(‘Asia/Bangkok’).format();

<ion-datetime (ionChange)=“getPickedDate()” displayFormat=‘DD/MMM/YYYY hh:mm a’ pickerFormat=‘DD/MMM/YYYY hh:mm a’ [(ngModel)]=“pickedDate” placeholder=“Pick Date”>

I need to show the placeholder as “Pick Date” and after open the picker, it needs to show the mentioned timezone datetime value. This is my expected behaviour, but right now placeholder now showing and current time of the mentioned timezone showing in the picker field before picker open.

Anyone having idea to break this, let me know.

1 Like