mirror of
https://github.com/evroon/bracket.git
synced 2026-04-21 07:47:02 -04:00
Fix sorting of matches on dashboard (#1129)
fixes https://github.com/evroon/bracket/issues/979 also reverses the order so it is now in ascending order from oldest to most recent match.
This commit is contained in:
@@ -13,3 +13,7 @@ export function Time({ datetime }: { datetime: string }) {
|
||||
export function formatTime(datetime: string) {
|
||||
return format(parseISO(datetime), 'HH:mm');
|
||||
}
|
||||
|
||||
export function compareDateTime(datetime1: string, datetime2: string) {
|
||||
return parseISO(datetime1) > parseISO(datetime2);
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import React from 'react';
|
||||
import { DashboardFooter } from '../../../../components/dashboard/footer';
|
||||
import { DoubleHeader, TournamentHeadTitle } from '../../../../components/dashboard/layout';
|
||||
import { NoContent } from '../../../../components/no_content/empty_table_info';
|
||||
import { Time, formatTime } from '../../../../components/utils/datetime';
|
||||
import { Time, compareDateTime, formatTime } from '../../../../components/utils/datetime';
|
||||
import { Translator } from '../../../../components/utils/types';
|
||||
import { responseIsValid } from '../../../../components/utils/util';
|
||||
import { formatMatchInput1, formatMatchInput2 } from '../../../../interfaces/match';
|
||||
@@ -134,7 +134,7 @@ export function Schedule({
|
||||
.filter((m1: any) => m1.match.start_time != null)
|
||||
.sort(
|
||||
(m1: any, m2: any) =>
|
||||
-formatTime(m1.match.start_time).localeCompare(formatTime(m2.match.start_time)) ||
|
||||
compareDateTime(m1.match.start_time, m2.match.start_time) ||
|
||||
m1.match.court?.name.localeCompare(m2.match.court?.name)
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user