Make WordPress Core


Ignore:
Timestamp:
10/01/2020 05:41:18 PM (6 years ago)
Author:
helen
Message:

WP Date: Add timezone abbreviation to wp-date settings.

Props mkaz.
Fixes #50624.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/script-loader.php

    r49081 r49083  
    323323                )
    324324        );
     325
     326        // Calculate the timezone abbr (EDT, PST) if possible.
     327        $timezone_string = get_option( 'timezone_string', 'UTC' );
     328        $timezone_abbr   = '';
     329
     330        if ( ! empty( $timezone_string ) ) {
     331                $timezone_date = new DateTime( null, new DateTimeZone( $timezone_string ) );
     332                $timezone_abbr = $timezone_date->format( 'T' );
     333        }
    325334
    326335        $scripts->add_inline_script(
     
    356365                                        'timezone' => array(
    357366                                                'offset' => get_option( 'gmt_offset', 0 ),
    358                                                 'string' => get_option( 'timezone_string', 'UTC' ),
     367                                                'string' => $timezone_string,
     368                                                'abbr'   => $timezone_abbr,
    359369                                        ),
    360370                                )
Note: See TracChangeset for help on using the changeset viewer.