refactor: fixed code refactor and added new slices and selector

This commit is contained in:
SundasNoreen
2023-06-05 19:55:46 +05:00
parent 78a40d47c1
commit cabf4e3f27
9 changed files with 108 additions and 77 deletions

View File

@@ -17,11 +17,13 @@ export const splitNotificationsByTime = (notificationList) => {
splittedData = notificationList.reduce(
(result, notification) => {
const objectTime = new Date(notification.createdAt).getTime();
if (objectTime >= twentyFourHoursAgo && objectTime <= currentTime) {
result.today.push(notification);
} else {
result.earlier.push(notification);
if (notification) {
const objectTime = new Date(notification.createdAt).getTime();
if (objectTime >= twentyFourHoursAgo && objectTime <= currentTime) {
result.today.push(notification);
} else {
result.earlier.push(notification);
}
}
return result;
},