<div class="col-sm-3 form-group">
<input type="text" class="form-control"
placeholder="End Date"
formControlName="endDate"
[bsConfig]="{ containerClass: 'theme-dark-blue', dateInputFormat: 'YYYY-MM-DD' }"
bsDatepicker>
</div>
ngOnInit(){
this.createEditForm();
}
createEditForm(){
this.editForm = this.fb.group(
{
id: [this.id],
startDate: [this.startDate, Validators.required],
endDate: [this.endDate],
annualSalary: [this.annualSalary, Validators.required],
userId: [this.userId]
});
}
但是,当我更改输入日期时,前端显示正确的日期(例如当我键入2018-01-03时,它显示2018-01-03),而表单值显示为Day-1(2018-01-02)
还有没有一种方法可以将每个日期转换为字符串,只使用YYYY-MM-DD而不使用时间和区域?
我使用ngx boostrap 2.0.5(尝试3.0.1会产生错误)