Make WordPress Core

Opened 9 months ago

Closed 7 months ago

#60105 closed defect (bug) (fixed)

Add a timezone offset display value to wp.date.setSettings

Reported by: afercia's profile afercia Owned by: youknowriad's profile youknowriad
Milestone: 6.5 Priority: normal
Severity: normal Version:
Component: Script Loader Keywords: has-patch
Focuses: Cc:

Description

In https://github.com/WordPress/gutenberg/pull/56682 I'm proposing to add a timezone offset value for displaying purposes, to be used in the Gutenberg editor.

Right now, the editor is displaying the stored value which is a float number with decimals. For some timezone offsets, that displays incorrect values in the UI like 5:75 instead of 5:45.

There's already a couple places in Core where such a conversion is in place for displaying purposes:

It would be a one line addition:

'offsetFormatted' => str_replace( array( '.25', '.5', '.75' ), array( ':15', ':30', ':45' ), (string) get_option( 'gmt_offset', 0 ),

Attachments (1)

60105.diff (926 bytes) - added by afercia 8 months ago.

Download all attachments as: .zip

Change History (7)

#1 @afercia
9 months ago

  • Summary changed from Add a timezone offset display value to `wp.date.setSettings` to Add a timezone offset display value to wp.date.setSettings

@afercia
8 months ago

#2 @afercia
8 months ago

  • Keywords has-patch added; needs-patch removed

https://github.com/WordPress/gutenberg/pull/56682 has been merged in the Gutenberg repository. As such, those changes need to be ported to the Core wp.date.setSettings in the script-loader.php file. 60105.diff just does that.

#3 follow-up: @afercia
8 months ago

As a follow-up to the changes in Gutenberg, a few translators comments have been improved in https://github.com/WordPress/gutenberg/pull/58488. It would be good to improve the ones in Core as well.

#5 in reply to: ↑ 3 @afercia
8 months ago

Replying to afercia:

As a follow-up to the changes in Gutenberg, a few translators comments have been improved in https://github.com/WordPress/gutenberg/pull/58488. It would be good to improve the ones in Core as well.

Oh I see the translators comments are already tracked at #60412

#6 @youknowriad
7 months ago

  • Owner set to youknowriad
  • Resolution set to fixed
  • Status changed from new to closed

In 57556:

Script Loader: Add a timezone offset display value to wp.date.setSettings.

Fixes a bug in the editor where the offset values are displayed as decimals rather than minutes.

Props afercia, get_dave.
Fixes #60105.

Note: See TracTickets for help on using tickets.