I need to update the date format displayed in my field within Reactive forms. Currently, it shows as "16-03-1999" but I want it to display as "March 16, 1999."
Here is the relevant code:
In my TypeScript file:
this.companyForms = this.fb.group({
})
I am dynamically adding a control to the form using API response:
this.companyForms.addControl("EFFECTIVE_DATE", new FormGroup({
'DEFAULT VALUE': new FormControl(null)
}))
In the HTML file:
<form [formGroup]="companyForms">
<div class="row pt-2" formGroupName="EFFECTIVE_DATE">
<input type="date" class="form-control bg-light" name="DEFAULT VALUE" formControlName="DEFAULT VALUE" [value]="companyForms.get(['EFFECTIVE_DATE','DEFAULT VALUE'])| date:'longDate' ">
</div>
</form>
While attempting to use the built-in pipe longDate to change the date format, it still displays as 'dd-mm-yyyy'. I want it in "mmmm dd, yyyy" (June 26, 2019) format.
The placeholder for the date field continues to show the default format of dd-mm-yyyy.
If anyone has suggestions on how to achieve the desired format, your input would be greatly appreciated. Thank you!