I have a function ("get only the recent") to filter out JSON items from JSON array where CreatedDate was not created within the last 5 minutes.
OR to put it in another perspective.......
keep all JSON array items that have a CreatedDate within the last 5 minutes.
I am just missing something and I can't seem to see it.
var now = new Date() console.info("Now: " + now); var fiveMinutesAgo = new Date() fiveMinutesAgo.setMinutes(-5) console.info("Filter by Date: " + fiveMinutesAgo); var permitDateTime = new Date(el => el.DateCreated); msg.payload = msg.payload.filter(el => el.DateCreated.includes(permitDateTime.getTime() < fiveMinutesAgo.getTime())) return msg;