Data shouldn't duplicate or it should remove the duplicate data.
Here's the code:
dateList = [
[{
date: "2019-12-12 03:00:00"
},{
date: "2019-12-12 03:16:14"
},{
date: "2019-12-12 03:16:14"
},{
date: "2019-12-13 03:16:14"
},{
date: "2019-12-11 03:16:14"
}],
[{
date: "2019-12-12 03:16:14"
},{
date: "2019-12-12 03:16:14"
},{
date: "2019-12-12 03:16:14"
},{
date: "2019-12-13 03:16:14"
},{
date: "2019-12-11 03:16:14"
}],
[{
date: "2019-12-12 03:16:14"
},{
date: "2019-12-12 03:16:14"
},{
date: "2019-12-12 03:16:14"
},{
date: "2019-12-13 03:16:14"
},{
date: "2019-12-17 03:16:14"
}],
[{
date: "2019-12-12 03:16:14"
},{
date: "2019-12-12 03:16:14"
},{
date: "2019-12-12 03:16:14"
},{
date: "2019-12-13 03:16:14"
},{
date: "2019-12-15 03:16:14"
}],
]
dateList.map((x: any) => {
x.filter((item: any) => {
console.log(item);
});
});
How to combine or merge without duplicating or remove the same date data based on the date in angular.
Example output:
[
{
date: "2019-12-12 03:00:00"
},
{
date: "2019-12-13 03:16:14"
},
{
date: "2019-12-17 03:16:14"
},
{
date: "2019-12-15 03:16:14"
}
]
The same date should be removed and if the data not the same it will stay.
.reduce()instead of a.map()