Hey I am working on a attendance project in reactjs , I am facing a problem that I received an array of attendances e.g (in range of last two weeks ) . All I need is filter an array of distinct date, not the time but only date . (Time can be different in one date)
let dates = [
{ id: 51, attendanceTime: "2022-12-26T06:07:02.000Z" },
{ id: 52, attendanceTime: "2022-11-26T06:07:36.000Z" },
{ id: 53, attendanceTime: "2022-10-12T06:28:43.000Z" },
{ id: 54, attendanceTime: "2023-01-01T06:48:53.000Z" },
{ id: 55, attendanceTime: "2022-12-26T06:56:23.000Z" },
];
I have tried methods but gettime() compare all not only date , getDate() compare only Day not month and year , So I need to filter such that it only differentiate on only date (day,month,year) and filter my array of distinct array. I need result like
const result = [
{ id: 51, attendanceTime: "2022-12-26T06:07:02.000Z" },
{ id: 52, attendanceTime: "2022-11-26T06:07:36.000Z" },
{ id: 53, attendanceTime: "2022-10-12T06:28:43.000Z" },
{ id: 54, attendanceTime: "2023-01-01T06:48:53.000Z" },
];
this is required result of distinct date array