I want to change the default date format in one of my fields in Reactive forms. It is appearing in the following format "16-03-1999" but I want to change in following format "March 16, 1999".
Below is the code for the same :
In type script file :
this.companyForms = this.fb.group({
})
I am adding the control dynamically in the form using the response of API
this.companyForms.addControl("EFFECTIVE_DATE", new FormGroup({
'DEFAULT VALUE': new FormControl(null)
}))
In 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>
I am trying to change the format of the date by using built in pipe longDate which is basically used to convert the date format into desired format. But after applying pipe also it is appearing in the same format 'dd-mm-yyyy'. I want it in "mmmm dd, yyyy" (June 26, 2019) format.
The date field still showing the default format in placeholder that is dd-mm-yyyy.
Any suggestions regarding this will be helpful. Thanks in advance.