WordPress.org

Making WordPress.org

Changeset 7069


Ignore:
Timestamp:
04/09/2018 09:28:29 PM (4 years ago)
Author:
iandunn
Message:

WP15: Use an unlocalized format when converting between timezones.

Props pedromendonca.
Fixes #3560.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wp15.wordpress.net/public_html/content/plugins/wp15-meetup-events/wp15-meetup-events.php

    r7052 r7069  
    110110        $event['longitude']   = ! empty( $event['venue']['lon'] ) ? $event['venue']['lon'] : $event['group']['group_lon'];
    111111        $event['group']       = $event['group']['name'];
    112         $event['description'] = isset( $event['description'] ) ? $event['description'] : '';
     112        $event['description'] = isset( $event['description'] ) ? trim( $event['description'] ) : '';
    113113        $event['time']        = $event['time'] / 1000;  // Convert to seconds.
    114114        $event['location']    = trim( implode( ' ', $location ) );
     
    306306 */
    307307function get_local_formatted_date( $utc_timestamp, $timezone ) {
     308    // translators: Do not include `T`, `P`, or `O`, because that will show the site's timezone/difference, not the event's. The event dates will already be converted to their local timezone.
    308309    $date_format = _x( 'F jS, Y g:ia', 'WP15 event date format', 'wp15' );
    309310
     
    312313        $utc_datetime->setTimezone( new DateTimeZone( $timezone ) );
    313314
    314         $local_timestamp = strtotime( $utc_datetime->format( $date_format ) );
     315        // Convert to a timestamp in the local timezone, in order to pass through `date_i18n()` for month name translation.
     316        $local_timestamp = strtotime( $utc_datetime->format( 'Y-m-d H:i' ) );
    315317        $formatted_date  = date_i18n( $date_format, $local_timestamp );
    316318    } catch ( Exception $exception ) {
Note: See TracChangeset for help on using the changeset viewer.