I have a question. If I have a datepicker that returns me data like this:
How can I convert this result into a date of type ISO? so that it can be stored in MongoDB.
This is the code of the html part.
<form class="row row-cols-sm-auto" [formGroup]="dateForm" (submit)="Date()">
<div class="col-md-6 col-lg-3 col-xlg-3">
<div class="input-group">
<input class="form-control" readonly formControlName="date"
name="dp" [(ngModel)]="model" ngbDatepicker #d="ngbDatepicker">
<button class="btn btn-primary btn-sm" (click)="d.toggle()" type="button">
Date
</button>
</div>
</form>
This is the typescript part:
ngOnInit(): void {
this.dateForm = this.fb.group({
date: ['', Validators.required]
})
}
Date(){
const { date } = this.dateForm.value
console.log(date)
}
Thanks in advance.
