Order upcoming classes by nearest date

This commit is contained in:
Tanner Collin 2020-09-21 20:01:47 +00:00
parent 6aa59a46dc
commit e263a6847f

View File

@ -72,13 +72,19 @@ export function Classes(props) {
<Header size='large'>Class List</Header> <Header size='large'>Class List</Header>
<Header size='medium'>Upcoming</Header> <Header size='medium'>Upcoming</Header>
<p>Ordered by nearest date.</p>
{classes ? {classes ?
<ClassTable classes={classes.filter(x => x.datetime > now)} /> <ClassTable classes={classes.filter(x => x.datetime > now).sort((a, b) => a.datetime > b.datetime ? 1 : -1)} />
: :
<p>Loading...</p> <p>Loading...</p>
} }
<Header size='medium'>Recent</Header> <Header size='medium'>Recent</Header>
<p>Ordered by nearest date.</p>
{classes ? {classes ?
<ClassTable classes={classes.filter(x => x.datetime < now)} /> <ClassTable classes={classes.filter(x => x.datetime < now)} />
: :