在片刻格式之后它显示完全不同的值

时间:2018-03-17 06:46:11

标签: javascript angular typescript ionic3 momentjs

你能告诉我为什么会出现这种奇怪的行为吗?这是由于传入日期格式问题还是其他?

html的

 <ion-datetime displayFormat="D MMM, YYYY" [min]="minDate" [max]="maxDate" 
[ngModel]="data?.dueOn" (ngModelChange)="data.dueOn=$event;"
name="dueOn" class="date-picker-right-align"></ion-datetime>

.TS

auditLogDueOnDays = `Payment due date changed from 
${moment(this.oldTransactionValue.dueOn).format("d MMM YY")} to 
${moment(data.dueOn).format("d MMM YY")} `;

enter image description here

1 个答案:

答案 0 :(得分:0)

那是我的坏事:(

  

星期几d 0 1 ... 5 6

我必须使用:

  

日期D 1 2 ... 30 31

auditLogDueOnDays = `Payment due date changed from 
${moment(this.oldTransactionValue.dueOn).format("D MMM YY")} to 
${moment(data.dueOn).format("D MMM YY")} `;