【发布时间】:2017-03-20 19:57:33
【问题描述】:
我在 PrimeNG 的日历组件中有以毫秒为单位的时间
HTML
<p-calendar [(ngModel)]="task.startDate"
[minDate]="minDateValue"
[maxDate]="maxDateValue"
readonlyInput="readonlyInput"
[showIcon]="true">
</p-calendar>
TypeScript
"startDate":1490039621704,
但是我得到了以下错误
EXCEPTION: Uncaught (in promise): TypeError: date.getMonth is not a function
TypeError: date.getMonth is not a function
有没有办法告诉组件以特定格式读取日期,比如我的情况是毫秒
更新
根据文档here,以毫秒为单位的日期格式应为 @ - Unix 时间戳(自 1970 年 1 月 1 日起为毫秒)
所以我在组件中添加了属性dateFormat="@",但似乎没有修复它。
【问题讨论】:
标签: angular typescript datepicker primeng