Make WordPress Core

Opened 3 years ago

Closed 3 years ago

#60105 closed defect (bug) (fixed)

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

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

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 3 years ago.

Download all attachments as: .zip

Change History (7)

#1 @afercia
3 years ago

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

@afercia
3 years ago

#2 @afercia
3 years 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
3 years 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
3 years 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
3 years ago

  • Owner set to youknowriad
  • Resolution → fixed
  • Status new → 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.