Compare dates from an array object with the current date. the current date is taken from MongoDB.
{"specialData": [
{
"content": {
"dateAdded": "2017-12-26T22:21:37+00:00"
}
},
{
"content": {
"dateAdded": "2018-01-12T22:21:37+00:00"
}
}
]
}
compare the content.dateAdded from the array object with the current date coming from MongoDB. current date coming from catalogue.metaData.lastUpdatedDate
let result = _.find(rokuFeeds.tvSpecials, function (n) {
if (new Date(n.content.dateAdded) < new Date(catalogue.metaData.lastUpdatedDate)) {
return true;
}
});
I'm trying like this