Skip to content

Commit

Permalink
Rename variable and clean up.
Browse files Browse the repository at this point in the history
  • Loading branch information
afercia committed Dec 29, 2023
1 parent c0859f2 commit d816dbb
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/compat/wordpress-6.5/script-loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ function gutenberg_update_wp_date_timezone_settings( $scripts ) {
),
'timezone' => array(
'offset' => (float) $gmt_offset,
'offsetFormatted' => str_replace( array( '.25', '.5', '.75' ), array( ':15', ':30', ':45' ), (string) $gmt_offset ),
'string' => $timezone_string,
'abbr' => $timezone_abbr,
'formattedOffset' => str_replace( array( '.25', '.5', '.75' ), array( ':15', ':30', ':45' ), (string) $gmt_offset ),
),
)
)
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/date-time/time/timezone.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const TimeZone = () => {
const zoneAbbr =
'' !== timezone.abbr && isNaN( Number( timezone.abbr ) )
? timezone.abbr
: `UTC${ offsetSymbol }${ timezone.formattedOffset }`;
: `UTC${ offsetSymbol }${ timezone.offsetFormatted }`;

// Replace underscore with space in strings like `America/Costa_Rica`.
const prettyTimezoneString = timezone.string.replace( '_', ' ' );
Expand Down
4 changes: 2 additions & 2 deletions packages/date/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ import deprecated from '@wordpress/deprecated';
/**
* @typedef TimezoneConfig
* @property {string} offset Offset setting.
* @property {string} offsetFormatted Offset setting with decimals formatted to minutes.
* @property {string} string The timezone as a string (e.g., `'America/Los_Angeles'`).
* @property {string} abbr Abbreviation for the timezone.
* @property {string} formattedOffset Offset setting with decimals formatted to minutes.
*/

/* eslint-disable jsdoc/valid-types */
Expand Down Expand Up @@ -133,7 +133,7 @@ let settings = {
datetime: 'F j, Y g: i a',
datetimeAbbreviated: 'M j, Y g: i a',
},
timezone: { offset: '0', string: '', abbr: '', formattedOffset: '0' },
timezone: { offset: '0', offsetFormatted: '0', string: '', abbr: '' },
};

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/editor/src/components/post-schedule/label.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ function getTimezoneAbbreviation() {
}

const symbol = timezone.offset < 0 ? '' : '+';
return `UTC${ symbol }${ timezone.formattedOffset }`;
return `UTC${ symbol }${ timezone.offsetFormatted }`;
}

function isTimezoneSameAsSiteTimezone( date ) {
Expand Down
2 changes: 1 addition & 1 deletion packages/editor/src/components/post-schedule/test/label.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ describe( 'getFullPostScheduleLabel', () => {

setSettings( {
...settings,
timezone: { formattedOffset: 10 },
timezone: { offsetFormatted: 10 },
} );

const label = getFullPostScheduleLabel( '2022-04-28T15:30:00' );
Expand Down

0 comments on commit d816dbb

Please sign in to comment.