I have the array like this
myArray=[{
id:1,
date:2019-03-17,
title:'name1'
},
{
id:2,
date:2019-04-17,
title:'name2'
},
{
id:3,
date:2019-05-17,
title:'name3'
},
]
how can I update it and get a new array like below
newArray=[
{
id:1,
date:moment(2019-03-17).format('L'),
title:'name1'
},
{
id:2,
date:moment(2019-04-17).format('L'),
title:'name2'
},
{
id:3,
date:moment(2019-05-17).format('L'),
title:'name3'
},
]
the above is just my example. The real problem is I got dates from Postgres, and these dates do not have timezone. So I need to use moment to format all dates that I got from database Thanks