I have two inputs in my application and i'm trying to combine them in a single object (cuz the server expect a single object)
template:
<ion-item>
<mat-form-field>
<mat-label>Data Appuntamento</mat-label>
<input matInput [matDatepicker]="picker" [(ngModel)]="this.DataPrenotazione" >
<mat-hint>DD/MM/YYYY</mat-hint>
<mat-datepicker-toggle matIconSuffix [for]="picker"></mat-datepicker-toggle>
<mat-datepicker #picker></mat-datepicker>
</mat-form-field>
<ion-label>Ora Appuntamento</ion-label>
<ngx-timepicker-field [format]="24" [(ngModel)]="this.OraPrenotazione" [minutesGap]="15"></ngx-timepicker-field>
</ion-item>
i then call this to combine the inputs:
combineDateTime(date: Date, time: Date): Date {
const combinedDateTime = new Date();
combinedDateTime.setFullYear(date.getFullYear());
combinedDateTime.setMonth(date.getMonth());
combinedDateTime.setDate(date.getDate());
combinedDateTime.setHours(time.getHours());
combinedDateTime.setMinutes(time.getMinutes());
return combinedDateTime;
}
when i try to call the combine function i get the ".getFullYear() is not a function"
this.combineDateTime(this.DataPrenotazione, this.OraPrenotazione)