【发布时间】:2017-12-09 02:14:47
【问题描述】:
我在 angular2 中使用 my-date-picker,当我从 datepicker 中选择任何日期时,它会像这样在 JSON 中为我提供 datepicker 的输出
"effectiveDate":{"date":{"year":2017,"month":7,"day":1},"jsdate":"2017-06-30T18:30:00.000Z","formatted":"07/01/2017","epoc":1498847400} 但我想要像 "effectiveDate":"07/01/2017" 这样的输出。
获取输出:
"effectiveDate":{"date":{"year":2017,"month":7,"day":1},"jsdate":"2017-06-30T18:30:00.000Z","formatted":"07/01/2017","epoc":1498847400}
需要输出:
"effectiveDate":"07/01/2017"
【问题讨论】:
-
将其转换为字符串并使用字符串值
-
(dateChanged)="model.birthDate = $event.formatted"
标签: json datepicker angular2-forms