Skip to content

Commit

Permalink
Implemented sorting by start date for both exception groups and indiv…
Browse files Browse the repository at this point in the history
…idual dates (#528)
  • Loading branch information
chris-hellen authored Jun 13, 2024
1 parent 6290e2d commit b0031e2
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/views/panes/InfoPane.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,21 @@ export const InfoPane: FunctionComponent<InfoPaneProps> = (
} 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) => ({
Expand All @@ -108,7 +115,7 @@ export const InfoPane: FunctionComponent<InfoPaneProps> = (
<>
<Pane
paneTitle={calendar.name}
defaultWidth="fill"
defaultWidth="30%"
centerContent
onClose={props.onClose}
dismissible
Expand Down

0 comments on commit b0031e2

Please sign in to comment.