I tried this but I can\'t make it work.
I have an array of dates like this: [\'5/15/2017, 2:59:06 PM\', \'5/15/2017, 2:59:16 PM\', ...
]
And I wa
Part of the issue is that you're only looking at the hour of the day, but you're actually comparing absolute dates.
The other issue you have is moment isn't correctly parsing your date strings. To rectify this, you can provide a format string to instruct moment on how to parse apart the important bits:
const PARSE_FORMAT = 'M/D/YYYY, H:mm:ss A';
const twoMinutesAgo = moment().subtract(2, 'minutes')
myArray.filter(stat => moment(stat.date, PARSE_FORMAT).isAfter(twoMinutesAgo));