Is there a way to save the date and time fields in a variable with the format: 0000-00-00T00:00:00.000Z?
component.html
<mat-form-field appearance="outline" class="pr-sm-8" fxFlex="50">
<mat-label>Fecha Inicio</mat-label>
<input matInput placeholder="Date"
[matDatepicker]="DatePicker"
name="date"
formControlName="date" readonly required>
<mat-datepicker-toggle matSuffix [for]="DatePicker"></mat-datepicker-toggle>
<mat-datepicker #DatePicker
startView="multi-year"
(yearSelected)="chosenYearHandler($event)"
(monthSelected)="chosenMonthHandler($event, DatePicker)"></mat-datepicker>
</mat-form-field>
<mat-form-field appearance="outline" class="pl-sm-8 no-errors-spacer" fxFlex="50">
<mat-label>Hora:</mat-label>
<input matInput
type="time"
formControlName="time" required>
</mat-form-field>
component.ts
createComposeForm(): FormGroup {
return this._formBuilder.group({
date: [''],
time: [''],
});
}
ngOnInit(): void {
this.form = this.createComposeForm();
let date = this.form.get('date').value.toISOString()
let time = this.form.get('time').value
}
14:52