<nz-form-item> <nz-form-label nzRequired nzSpan="4">完成日期</nz-form-label> <nz-form-control nzSpan="15"> <nz-date-picker nzFormat="yyyy-MM-dd" formControlName="completedAt" (ngModelChange)='dateChange($event)' [nzLocale]='locale'></nz-date-picker> <nz-form-explain *ngIf="isInvalid('completedAt')">请选择完成日期</nz-form-explain> </nz-form-control> </nz-form-item> add = this.form.group({ vehicleId: [null, [Validators.required]], meter: [null, [Validators.required]], completedAt: [null, [Validators.required]], vendorId: [null], reference: [null], }); dateChange(value){ this.date=value; console.log(moment(this.add.value.completedAt).format('YYYY-MM-DD') ); console.log(+this.add.value.completedAt) }
我想问的是能不用自己转换格式或者用monent.js 通过配置直接让传给后端的是字符串格式的时间么
暮色呼如
幕布斯6054654
相关分类