I am using ng-bootstrap date picker. this is my html for datepicker input
<input type="text"
id="datepicker{{i}}"
class="form-control"
formControlName="dateJoined"
ngbDatepicker
#incorporatedDatePicker="ngbDatepicker"
(click)="incorporatedDatePicker.toggle()"
(dateSelect)="onDateSelection($event)"
readonly>
However i am unable to set a default date to this input field before i select from the datepicker itself.
I am using reactive form here and i had already assigned NgbDateStruct Date as the form value
const strDateTime = driver['JoinDate'];
const arr = strDateTime.split(' ');
const strDate = arr[0];
const dateArr = strDate.split('/');
const ngbDate: NgbDateStruct = {
year: dateArr[2],
month: dateArr[1],
day: dateArr[0],
}
this.addDriverForm.patchValue({
dateJoined: ngbDate
})