Skip to content

Commit

Permalink
removed the current/future event from the pastEvents.
Browse files Browse the repository at this point in the history
  • Loading branch information
L-Steinmacher committed Sep 28, 2023
1 parent 728d4a5 commit 3c08ea3
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions app/elements/events-list.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
export default function EventsList({ html, state }) {
const { store } = state
const events = store.data

if (events.length > 0) {
// The last item in the array is the current event
let pastEvents = store.data.slice(0, -1).sort((a,b) => new Date(b.date) - new Date(a.date))

if (pastEvents.length > 0) {
return html`
<style>
@media only screen and (min-width: 768px) {
Expand All @@ -22,8 +24,7 @@ export default function EventsList({ html, state }) {
</style>
<ul>
${events.sort((a,b) => new Date(b.date) - new Date(a.date))
.map(
${pastEvents.map(
e => `
<li >
<a target="_self" href="/events/${e.id}">
Expand Down

0 comments on commit 3c08ea3

Please sign in to comment.