Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ public function is_in_the_past() {
return $this->utc() < Translation_Events::now();
}

public function is_more_than_one_year_in_the_future(): bool {
$now = Translation_Events::now();
return $this->utc() > $now->modify( '+1 year' );
}
Comment thread
itzmekhokan marked this conversation as resolved.

public function print_relative_time_html() {
echo wp_kses(
'<time
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,12 +266,14 @@ function ( $contributor ) {
<?php $event->start()->print_relative_time_html(); ?>
</span>
<?php $event->start()->print_time_html(); ?>
<?php $end = $event->end(); ?>
<?php if ( $end->is_in_the_past() || ! $end->is_more_than_one_year_in_the_future() ) : ?>
<span class="event-details-date-label">
<?php echo esc_html( $event->end()->is_in_the_past() ? __( 'Ended', 'gp-translation-events' ) : __( 'Ends', 'gp-translation-events' ) ); ?>:
<?php $event->end()->print_relative_time_html(); ?>

<?php echo esc_html( $end->is_in_the_past() ? __( 'Ended', 'gp-translation-events' ) : __( 'Ends', 'gp-translation-events' ) ); ?>:
<?php $end->print_relative_time_html(); ?>
</span>
<?php $event->end()->print_time_html(); ?>
<?php $end->print_time_html(); ?>
<?php endif; ?>
</p>
</div>
<?php if ( is_user_logged_in() ) : ?>
Expand Down
Loading