I have an array of data similar to this:
var items  = [
  { id: 84, "completedDate":"2019-01-26T17:45:07.895Z" },
  { id: 92, "completedDate":"2019-02-26T17:45:07.895Z" }, 
  { id: 123, "completedDate":"2019-03-26T17:45:07.895Z" }, 
  { id: 2353, "completedDate":"2019-04-26T17:45:07.895Z" }
];
I would like to return an array with only objects less than 30 days old.
I have tried to filter
var filtered = items.filter(function(item) { 
  return moment(item.completedDate) > moment.subtract(30, 'days');  
});
Is this what I need to do, or is there a better way to do this?
 
     
     
    