From b0031e2091b4f36b7282ced6758ec26b692612d7 Mon Sep 17 00:00:00 2001 From: Christopher Hellen Date: Thu, 13 Jun 2024 11:11:17 -0500 Subject: [PATCH] Implemented sorting by start date for both exception groups and individual dates (#528) --- src/views/panes/InfoPane.tsx | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/views/panes/InfoPane.tsx b/src/views/panes/InfoPane.tsx index 27f6872f..c7fde3ac 100644 --- a/src/views/panes/InfoPane.tsx +++ b/src/views/panes/InfoPane.tsx @@ -82,14 +82,21 @@ export const InfoPane: FunctionComponent = ( } else { exception.openings.sort((a, b) => { return Math.sign( - new Date(`${a.startDate} ${a.endDate}`).getTime() - - new Date(`${b.startDate} ${b.endDate}`).getTime(), + new Date(`${a.startDate}`).getTime() - + new Date(`${b.startDate}`).getTime(), ); }); ex.openings.push(exception); } }); + ex.openings.sort((a, b) => { + return Math.sign( + new Date(`${a.startDate}`).getTime() - + new Date(`${b.startDate}`).getTime(), + ); + }); + return { openings: generateExceptionalOpeningRows(intl, ex.openings), closures: ex.closures.map((exception) => ({ @@ -108,7 +115,7 @@ export const InfoPane: FunctionComponent = ( <>