use actual occurrences in date list
This commit is contained in:
@ -63,6 +63,8 @@ const EventFragmentDefinition = graphql(`
|
||||
id
|
||||
slug
|
||||
title
|
||||
preposition
|
||||
url
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -102,9 +104,13 @@ export function getSingularEvents(events: EventFragment[]): SingularEvent[] {
|
||||
.flat();
|
||||
}
|
||||
|
||||
export function compareDates(a: Date | string, b: Date | string) {
|
||||
return compareAsc(new Date(a), new Date(b));
|
||||
}
|
||||
|
||||
export function sortSingularEvents(events: SingularEvent[]) {
|
||||
return events.sort((a, b) =>
|
||||
compareAsc(new Date(a.occurrence.start), new Date(b.occurrence.start))
|
||||
compareDates(a.occurrence.start, b.occurrence.start)
|
||||
);
|
||||
}
|
||||
interface EventsByDate {
|
||||
|
Reference in New Issue
Block a user