In Employee selection double Date is shown in Front.
This commit is contained in:
parent
8c3b10f1cb
commit
7e05cfbd61
@ -59,13 +59,28 @@ const AttendancesEmployeeRecords = ({ employee }) => {
|
||||
.sort(sortByName);
|
||||
const group5 = data.filter((d) => d.activity === 5).sort(sortByName);
|
||||
|
||||
const sortedFinalList = [
|
||||
...group1,
|
||||
...group2,
|
||||
...group3,
|
||||
...group4,
|
||||
...group5,
|
||||
];
|
||||
// const sortedFinalList = [
|
||||
// ...group1,
|
||||
// ...group2,
|
||||
// ...group3,
|
||||
// ...group4,
|
||||
// ...group5,
|
||||
// ];
|
||||
|
||||
const uniqueMap = new Map();
|
||||
|
||||
[...group1, ...group2, ...group3, ...group4, ...group5].forEach((rec) => {
|
||||
const date = moment(rec.checkInTime || rec.checkOutTime).format("YYYY-MM-DD");
|
||||
const key = `${rec.employeeId}-${date}`;
|
||||
const existing = uniqueMap.get(key);
|
||||
if (!existing || new Date(rec.checkInTime || rec.checkOutTime) > new Date(existing.checkInTime || existing.checkOutTime)) {
|
||||
uniqueMap.set(key, rec);
|
||||
}
|
||||
});
|
||||
|
||||
const sortedFinalList = [...uniqueMap.values()].sort((a, b) =>
|
||||
new Date(b.checkInTime || b.checkOutTime) - new Date(a.checkInTime || a.checkOutTime)
|
||||
);
|
||||
|
||||
const currentDate = new Date().toLocaleDateString("en-CA");
|
||||
const { currentPage, totalPages, currentItems, paginate } = usePagination(
|
||||
|
Loading…
x
Reference in New Issue
Block a user