【发布时间】:2018-10-30 12:26:29
【问题描述】:
我有这个对象数组:
[
{ id: '1', name: 'sam', entryTime: 2018-10-30T10:48:29.286Z },
{ id: '2', name: 'john', entryTime: 2018-10-30T11:37:23.874Z }
]
我的预期输出:
[
{ id: '1', name: 'sam', entryTime: 30 Oct 2018 },
{ id: '2', name: 'john', entryTime: 30 Oct 2018 }
]
这是我尝试过的:
const visitors = [..that above array]
visitors.map(index => index.entryTime = moment(index.entryTime).format('D MMM YYYY'));
在我的对象中获取无效日期。
【问题讨论】:
标签: javascript arrays object momentjs