I have a http post service that wants a date with time in this format:
YYYY-MM-DDTHH:MM:SSZ
In one form now I have a formGroup like this:
this.formBuilder.group({
name: [''],
startDate: [null],
})
but in the form I have three input:
<form [formGroup]="myForm">
<input type="text" formControlName="name">
<mat-datepicker formControlName="day?"></mat-datepicker>
<input type="number" formControlName="hour?">
<input type="number" formcontrolName="minutes?">
<form>
I have a datepicker for select a date, and two inputs for managing hour and minutes. My idea is to convert the formGroup in this way:
this.formBuilder.group({
name: [''],
day: [null],
hour: [null],
minutes: [null]
})
But the server needs only one field and I would have a clean way to do it...my idea was to create single fields for managing each value and in the submit compose the data in someway or is there another solution?