Translation Events: Hide end date when more than 1 year in the future#676
Translation Events: Hide end date when more than 1 year in the future#676itzmekhokan wants to merge 2 commits into
Conversation
On the event details page, stop displaying the end date and its relative time (e.g. "Ends: in 9 years") when the end date is more than one year away. Past end dates and near-future ones are unaffected. Fixes https://meta.trac.wordpress.org/ticket/8280
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR adds logic to suppress displaying an event “End” timestamp when the event end date is more than one year in the future.
Changes:
- Adds
Event_Date::is_more_than_one_year_in_the_future()helper for date comparison. - Updates the event details template to conditionally render the “Ends/Ended” UI only when relevant.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/templates/event-details.php | Conditionally hides the end date block when the end time is far in the future. |
| wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/event/event-date.php | Introduces a helper method to detect end times more than one year ahead. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Extract Translation_Events::now() to a variable before calling modify() to make the immutability explicit and avoid any side-effect ambiguity. - Store $event->end() in a local $end variable in the event details template to avoid repeated method calls within the conditional block.
On the event details page, the end date and relative time (e.g. "Ends: in 9 years") are now hidden when the end date is more than one year in the future. Past end dates and near-future ones are unaffected.
Fixes https://meta.trac.wordpress.org/ticket/8280