When the input is of type 'Date', the date format is dd/MM/yyyy
.
I need to convert the date format from MM/dd/yyyy
to dd/MM/yyyy
(Turkish Format and Turkish Calendar).
Below is the code snippet.
<form [formGroup]="opportunityForm" (ngSubmit)="updateData(opportunityForm.value)">
<div class="form-group">
<label>Creation Date</label>
<input type="date" class="form-control" formControlName="createDate" required>
<div class="alert-danger" *ngIf="!opportunityForm.controls['createDate'].valid && (opportunityForm.controls['createDate'].touched)">
<div [hidden]="!opportunityForm.controls['createDate'].errors.required">
Date field is required
</div>
</div>
</div>
<button type="submit" class="btn btn-primary" [disabled]="!opportunityForm.valid">Update</button>
</form>
constructor(private http: HttpClient,private fb: FormBuilder,private router: Router,private actRoute: ActivatedRoute, private service:OpportunityService) {
this.opportunityForm=this.fb.group({
title:['',Validators.required],
description:['',Validators.required],
createDate:['',Validators.required],
expirationDate:['',Validators.required],
file: new FormControl(null)
});
Please provide suggestions and solutions. Thank you!