Skip to content
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

Modify how date is displayed on the event list #111

Merged
merged 5 commits into from
Feb 22, 2024
Merged

Conversation

trymebytes
Copy link
Collaborator

@trymebytes trymebytes commented Feb 19, 2024

Fixes #84

Before
image

After
image

@trymebytes trymebytes marked this pull request as draft February 19, 2024 22:03
@trymebytes trymebytes self-assigned this Feb 21, 2024
@trymebytes trymebytes marked this pull request as ready for review February 21, 2024 18:56
*
* @return string The end date text.
*/
public static function get_end_date_text( string $event_end ): string {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about putting this in the Event class? Seems like a better fit?

Copy link
Member

@akirk akirk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works well! Just the strings require some more attention.

$hours_in_a_day = 24;

if ( $hours_left <= $hours_in_a_day ) {
return 'ends in ' . $hours_left . ' hours';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use translation functions here, specifically _n() it will give us the hour/hours handling for free.

if ( $hours_left <= $hours_in_a_day ) {
return 'ends in ' . $hours_left . ' hours';
} else {
return 'until ' . $end_date_time->format( 'M j, Y' );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's avoid the string concat and use a sprintf() with a __() and a placeholder.

@trymebytes trymebytes requested a review from akirk February 22, 2024 11:17
Copy link
Member

@akirk akirk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worsk well in my testing!

@trymebytes trymebytes merged commit 8fa700c into trunk Feb 22, 2024
2 checks passed
@trymebytes trymebytes deleted the modify-list branch February 22, 2024 11:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Current events should display event end date/time
2 participants