Skip to content

Commit

Permalink
Add timezone to comments that have a different timezone
Browse files Browse the repository at this point in the history
  • Loading branch information
dshanske committed Jun 17, 2022
1 parent 27e0d14 commit 3ac36b9
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions includes/class-loc-timezone.php
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,7 @@ public static function get_the_modified_time( $the_time, $d = '', $post = null )
if ( '' === $d ) {
$d = get_option( 'time_format' );
}

return wp_date( $d, get_post_timestamp( $post, 'modified' ), $timezone );
}

Expand All @@ -524,6 +525,7 @@ public static function get_comment_date( $date, $d, $comment ) {
if ( '' === $d ) {
$d = get_option( 'date_format' );
}

$timezone = self::get_timezone( $comment );
if ( is_null( $timezone ) ) {
return $date;
Expand All @@ -539,6 +541,9 @@ public static function get_comment_time( $date, $d, $gmt, $translate, $comment )
if ( is_null( $timezone ) ) {
return $date;
}
if ( ( 'g:i a' === $d ) && ! self::compare_timezones( $timezone, wp_timezone() ) ) {
$d = 'g:i a T';
}
return wp_date( $d, get_comment_timestamp( $comment ), $timezone );
}

Expand Down

0 comments on commit 3ac36b9

Please sign in to comment.