-
Notifications
You must be signed in to change notification settings - Fork 0
Update event handling to support multi-day events #97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Deploying dda-website with
|
| Latest commit: |
15b5efb
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://298858d7.dda-website.pages.dev |
| Branch Preview URL: | https://multi-day-event.dda-website.pages.dev |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Adds support for multi-day events by replacing the single date field with startDate/endDate, updating all queries and UI components to use the new fields, and introducing a shared date‐range formatter and EventDate component.
- Switch query filters and sort orders from
datetostartDate - Refactor
formatDateutil for date ranges and wrap it in a newEventDatecomponent - Add DatoCMS migration to introduce
end_dateand renamestart_date
Reviewed Changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/pages/events/index.astro | Updated upcoming/past event filters and ordering to use startDate |
| src/pages/events/[slug]/index.astro | Replaced raw date formatting with EventDate in event detail header |
| src/pages/events/[slug]/_eventPage.query.graphql | Query now fetches startDate and endDate instead of date |
| src/pages/_index.query.graphql | Updated home page event query to filter/sort by startDate |
| src/lib/date.ts | Expanded formatDate util to handle optional end dates and ranges |
| src/components/EventDate/EventDate.tsx | New component rendering single or range dates consistently |
| src/blocks/EventList/components/List.tsx | Switched list items to use EventDate instead of formatDate |
| src/blocks/EventCard/EventCard.tsx | Updated event cards to use EventDate and removed date references |
| config/datocms/migrations/1747817814_mutiDayEvent.ts | Migration adding end_date field and renaming start_date |
| datocms-environment.ts | Changed CMS environment to multi-day-events for testing |
Comments suppressed due to low confidence (2)
config/datocms/migrations/1747817814_mutiDayEvent.ts:1
- The migration filename is misspelled as 'mutiDayEvent.ts'; consider renaming it to 'multiDayEvent.ts' for clarity.
config/datocms/migrations/1747817814_mutiDayEvent.ts
src/components/EventDate/EventDate.tsx:1
- The new EventDate component lacks unit tests; adding tests for single-day and multi-day rendering would improve confidence.
import { formatDate } from '@lib/date';
| if (!endDate) | ||
| return <time dateTime={startDate}>{formatDate(startDate)}</time>; | ||
|
|
||
| return <span>{formatDate(startDate, endDate)}</span>; |
Copilot
AI
May 21, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For multi-day events, consider using a element (possibly with two datetime attributes) instead of a plain to preserve semantic date semantics.
| return <span>{formatDate(startDate, endDate)}</span>; | |
| return ( | |
| <time dateTime={`${startDate}/${endDate}`}> | |
| {formatDate(startDate, endDate)} | |
| </time> | |
| ); |
- Change datocmsEnvironment to 'multi-day-events'. - Update EventCard and EventList components to use startDate and endDate instead of date. - Modify queries and filters to order and filter events by startDate. - Refactor date formatting to handle ranges for multi-day events.
Co-authored-by: Copilot <[email protected]>
29b3bee to
2a06640
Compare
Description
EventCardandEventListcomponents to usestartDateandendDateinstead ofdate.startDate.EventDatecomponent for consistent rendering of event dates.Changes
end_datefield to DatoCMS Event model via migration.startDateandendDate.lib/date.tsfor date range formatting.dateusage in queries, components, and pages.EventDatecomponent.Associated issue
https://trello.com/c/vnXxpvkU/104-events-van-meerdere-dagen
How to test
datocmsEnvironmentset tomulti-day-events.startDate.endDateis present.startDate/endDateand location render as expected.Checklist
Remember, contributions to this repository should follow its contributing guidelines.