Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70435

Problem with ion-datetime and ngmodel string

$
0
0

@miguelreb wrote:

Hi all,
i have a problem with an ion-datetime component, i have this code in the html:
<ion-datetime displayFormat=“DD/MM/YYYY HH:mm” [pickerOptions]=“customPickerOptionsFecCitaIni” [(ngModel)]=“Parte.CitaFechaHoraIni”>

The field citafechahoraini is a string value, with this format: 08/04/2020 23:45

The customPickerOptions is this:
this.customPickerOptionsFecCitaIni = {
buttons: [{
text: ‘Limpiar’,
handler: () => {
this.Parte.CitaFechaHoraIni = undefined
}
},{
text: ‘Cancelar’,
role:‘cancel’
}, {
text: ‘Guardar’,
handler: (data) => {
this.Parte.CitaFechaHoraIni = data.day.text+"/"+data.month.text+"/"+data.year.text+" “+data.hour.text+”:"+data.minute.text;
}
}]
};

If i open the page, in the datepicker i see this:
datepicker

and when i choose the date i see the month 8 when it will be 4. Why it occurs??
datepicker2

Any help? THANKS!

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70435

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>