From 3ac36b9a71311f0e745d6d342c2b31a0808c38e8 Mon Sep 17 00:00:00 2001 From: David Shanske Date: Fri, 17 Jun 2022 04:24:31 +0000 Subject: [PATCH] Add timezone to comments that have a different timezone --- includes/class-loc-timezone.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/includes/class-loc-timezone.php b/includes/class-loc-timezone.php index eaa363a..e3b2cae 100644 --- a/includes/class-loc-timezone.php +++ b/includes/class-loc-timezone.php @@ -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 ); } @@ -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; @@ -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 ); }