Skip to content

[Bug] Featured/Spotlight event is events[0] (unsorted, not the upcoming event) #19098

Description

@ionfwsrijan

Description

Across src/app/events/page.jsx, src/app/hackathons/page.jsx, and src/app/projects/page.jsx, the "Spotlight / Featured / Spotlight Project" banner always shows events[0] / hackathons[0] / projects[0] — whatever the backend returned first (typically most-recently-created), with no sorting by eventDate and no filtering to upcoming events.

const filteredEvents = events.filter((e) => { /* search/format/location */ });
const featuredEvent = events[0];   // first element of the raw, unsorted API array

Expected Behavior

Choose the soonest upcoming event (sort by eventDate ascending, optionally filter >= now) before picking the featured item.

Actual Behavior

The most prominent marketing surface of the homepage advertises an arbitrary (and possibly past or arbitrarily-ordered) item as the headline event. Combined with the date-handling bugs, a past date-only event can even render as "yesterday."

Proposed Fix

const now = Date.now();
const featuredEvent = [...events]
  .filter((e) => e.eventDate && new Date(e.eventDate).getTime() >= now)
  .sort((a, b) => new Date(a.eventDate) - new Date(b.eventDate))[0] || events[0];

References

  • src/app/events/page.jsx:64
  • src/app/hackathons/page.jsx:57
  • src/app/projects/page.jsx:58

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions