I've a parent array which has some objects in it and those objects have a property called created_at now I want to sort the parent array by the date.
let parent_array = [ { id: 1, date: '2022-12-01T20:34:52.000000Z' }, { id: 2, date: '2022-12-06T20:34:52.000000Z', }, ];
Now I want to sort parent_array by date value.
I tried this method
parent_array.filter((node: any) => {
            return node.sort((a: any, b: any) => {
                return new Date(b.created_at) - new Date(a.created_at);
            });
        })
But I'm getting an error "The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.ts(2362)"
Thank You Sakib
 
    