Fix/event widget date filtering (2nd try)#253
Open
gxjansen wants to merge 3 commits into
Open
Conversation
✅ Deploy Preview for spryker-community ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
fsmeier
reviewed
Apr 3, 2025
| ]); | ||
|
|
||
| // Fetch all events | ||
| const events = await getAllEvents(); |
Contributor
There was a problem hiding this comment.
when we can use the new Date() here, why dont we pass the date towards the function getAllEvents as parameter and really just query the needed timeframe?
| } | ||
| } | ||
|
|
||
| export async function getAllEvents(): Promise<FormattedEvent[]> { |
Contributor
There was a problem hiding this comment.
what about the other methods? do we still use them? If not i would propose to remove them because the more code we have the more we need to maintain over time and in a year from now we dont know much about the other code anymore.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Issue
The event widget on the homepage was showing past events in the 'Upcoming' section because the date comparison was happening at build time rather than runtime.
Solution
Implemented client-side filtering for the event widget to ensure correct date comparison:
This ensures that the date comparison happens in the browser at runtime, using the actual current date when a user visits the site, rather than the date at build time.
Testing