我正在使用ng-bootstrap datepicker,但是当我保存表单时,日期被保存为。
date: {
day: 01,
month: 12,
year: 16
}
我希望我能把它保存为更像的东西"2016-11-23T00:39:31.768Z"
这是我的实现:
<div class="input-group">
<button class="input-group-btn" (click)="d.toggle()" >
<md-icon svgSrc="assets/images/calendar-plus.svg" style="cursor: pointer;"></md-icon>
</button>
<input class="form-control" placeholder="dd-mm-yyyy" name="dp" formControlName="due_date" navigation="arrows" ngbDatepicker #d="ngbDatepicker">
</div>
和form.component:
constructor( private fb: FormBuilder ) {
this.form = this.fb.group({
due_date: [''],
});
}