[Vuejs]-How can I filter a nested javascript object and return the parent?

0👍

You can filter your data by createdAt property, and then in the filtered data, you can again filter purchasables like this:

this.items = this.orders.filter(order => dayjs(order.createdAt).isSame(this.day, "date")).map(item => ({...item, purchasables: item.purchasables.filter(p => p.type == 'FOO') }))

Leave a comment