From 51483f62e1d8bc1145f20b932d916ffd97119b7d Mon Sep 17 00:00:00 2001 From: Dave Richer Date: Thu, 18 Jan 2024 20:49:50 -0500 Subject: [PATCH] - optimize schedule out today in dashboard Signed-off-by: Dave Richer --- .../scheduled-out-today.component.jsx | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/client/src/components/dashboard-components/scheduled-out-today/scheduled-out-today.component.jsx b/client/src/components/dashboard-components/scheduled-out-today/scheduled-out-today.component.jsx index 0c794f1db..2d167c330 100644 --- a/client/src/components/dashboard-components/scheduled-out-today/scheduled-out-today.component.jsx +++ b/client/src/components/dashboard-components/scheduled-out-today/scheduled-out-today.component.jsx @@ -22,12 +22,13 @@ export default function DashboardScheduledOutToday({ data, ...cardProps }) { if (!data.scheduled_out_today) return ; - data.scheduled_out_today.forEach((item) => { - item.scheduled_completion= dayjs(item.scheduled_completion).format("hh:mm a") - }); - data.scheduled_out_today.sort(function (a, b) { - return new Date(a.scheduled_completion) - new Date(b.scheduled_completion); - }); + const filteredScheduledOutToday = data.scheduled_out_today.map((item) => { + return { + ...item, + scheduled_completion: dayjs(item.scheduled_completion).format("hh:mm a"), + timestamp: dayjs(item.scheduled_completion).valueOf(), + } + }).sort((a, b) => a.timestamp - b.timestamp); const columns = [ { @@ -171,7 +172,7 @@ export default function DashboardScheduledOutToday({ data, ...cardProps }) { scroll={{ x: true, y: "calc(100% - 2em)" }} rowKey="id" style={{ height: "85%" }} - dataSource={data.scheduled_out_today} + dataSource={filteredScheduledOutToday} />