I have an array of objects, it contains some data time value. How can I find the object key with "Date" and covert the value to moment date time?
const old = [
{name: "Ann", startDate: "2014-11-12T07:45:07.753", endDate: "2014-11-13T07:45:07.753"},
{name: "Ben", startDate: "2014-11-12T07:45:07.753", endDate: "2014-11-13T07:45:07.753"}
]
First I want to check if the object key has the string of "Date", then it would convert the object value to moment(value).format("YYYY-MM-DD h:mm:ss a")
const new = [
{name: "Ann", startDate: "2014-11-12 7:45:07am", endDate: "2014-11-13 7:45:07 am"},
{name: "Ben", startDate: "2014-11-12 7:45:07am", endDate: "2014-11-13 7:45:07 am"}
]