【发布时间】:2018-01-26 10:38:10
【问题描述】:
我的 Mongodb 上的日期以以下格式保存:
"toDate": {
"$date": "2018-01-24T18:30:00.000Z"
},
"fromDate": {
"$date": "2018-01-11T18:30:00.000Z"
}
当我尝试将日期设置为p-calendar Like 时
<p-calendar name="toDate" [(ngModel)]="productId.toDate" class="form-control" [showIcon]="true"></p-calendar>
错误:未捕获(承诺中):位置 0 处缺少数字
我尝试了什么? 更改日期格式如:
post.fromDate=new Date(post.fromDate).toUTCString();
post.toDate=new Date(post.toDate).toUTCString();
日期格式更改为Wed, 24 Jan 2018 18:30:00 GMT
但同样的错误仍然存在,
任何帮助都会很棒,谢谢
【问题讨论】:
标签: javascript mongodb angular date-format primeng