fix(talks): order future talks in reverse

Show the nearest upcoming talk first.
This commit is contained in:
Oliver Davies 2023-08-02 23:30:00 +01:00
parent 84c2c5f88d
commit 77ed75a699

View file

@ -22,9 +22,16 @@ const sortedTalks = talks
b.item.data.events[b.item.data.events.length - 1],
];
return (
new Date(events[0].date).valueOf() - new Date(events[1].date).valueOf()
);
const dates = [
new Date(events[0].date).valueOf(),
new Date(events[1].date).valueOf(),
];
if (dates[0] >= today) {
return 1;
}
return dates[0] - dates[1];
});
---