0

Javascript filter array onject

const data = [
  {
      text: "The Big Lunch",
      startDate: new Date('2023-01-27 11:00 UTC').toISOString(),
      endDate: new Date("2023-01-27 18:00 UTC").toISOString(),
      function_venue: "clareview_dining_room",
      allocation_quantity: 300,
      allocation_used: 50,
      allocation_remaining: 250,
      event_statusId : (250>100) ? 1 : 3,
      disabled: true  
    }, 
    {
      text: "The Big Lunch 2",
      startDate: new Date('2023-01-25 11:00 UTC').toISOString(),
      endDate: new Date("2023-01-25 18:00 UTC").toISOString(),
      function_venue: "the_big_bar",
      allocation_quantity: 300,
      allocation_used: 250,
      allocation_remaining: 50,
      event_statusId : (50>100) ? 1 : 3,
      disabled: true  
    }, 
    {
      text: "Birthday Party",
      startDate: new Date('2022-12-25 11:00 UTC').toISOString(),
      endDate: new Date("2022-12-26 18:00 UTC").toISOString(),
      function_venue: "legends_room",
      allocation_quantity: 200,
      allocation_used: 120,
      allocation_remaining: 80,
      event_statusId : (80>100) ? 1 : 3,
      disabled: true  
    }, 
    {
      text: "The Big Lunch 3",
      startDate: new Date('2022-12-25 11:00 UTC').toISOString(),
      endDate: new Date("2022-12-26 18:00 UTC").toISOString(),
      function_venue: "the_big_bar",
      allocation_quantity: 300,
      allocation_used: 250,
      allocation_remaining: 50,
      event_statusId : (50>100) ? 1 : 3,
      disabled: true  
    }, 
];
 var newData = data.filter(function (el){
      return el.startDate == time && el.function_venue == event ;
     // return el.startDate == time;
  }

admin Asked question December 12, 2022
Add a Comment