Skip to content

Commit

Permalink
sort the rounds in project page
Browse files Browse the repository at this point in the history
  • Loading branch information
HrithikSampson committed Oct 3, 2024
1 parent 1e3a5fd commit 422b4c9
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,14 @@ export const QfRoundSelector: FC<IQfRoundSelectorProps> = ({
const navigationNextRef = useRef(null);

const sortedRounds =
projectData?.qfRounds?.sort(
(a, b) => Number(b.isActive) - Number(a.isActive),
) || [];
projectData?.qfRounds?.sort((a: IQFRound, b: IQFRound) => {
const activeFirstCompare = Number(b.isActive) - Number(a.isActive);
console.log(a.beginDate, b.beginDate);
if (activeFirstCompare === 0) {
return new Date(b.beginDate) > new Date(a.beginDate) ? 1 : -1;
}
return activeFirstCompare;
}) || [];

const isRecurringSelected = projectDonationSwiperState.isRecurringSelected;
const selectedQF = projectDonationSwiperState.selectedQF;
Expand Down

0 comments on commit 422b4c9

Please sign in to comment.