Reputation: 1
How to convert the calendar into 24h format?
<form>
<div [formGroup]="formGroup">
<ng-bootstrap-datetime-angular
placeholder="Select DateTime"
inputDatetimeFormat="dd/MM/yyyy HH:mm "
formControlName="activeEndDate"
name="activeEndDate"
></ng-bootstrap-datetime-angular>
</div>
</form>
formGroup: FormGroup;
ngOnInit() {
this.formGroup = new FormGroup({
activeEndDate: new FormControl(null, {
validators: [Validators.required]
})
});
}
Upvotes: 0
Views: 134
Reputation: 361
Use this One
let ngbDate = this.form.controls['due_date'].value;
let myDate = new Date(ngbDate.year, ngbDate.month-1, ngbDate.day);
let formValues = this.form.value;
formValues['due_date'] = myDate;
<...>
http.post(url, formValues);
Upvotes: 0