Description
openedon Nov 17, 2023
Description
Splitting this out from #56211 (comment)
When the WordPress timezone setting is set to a time zone with minutes e.g. UTC+5:45
, the actual value stored internally is a number with decimals e.g. 5.75
.
There's a couple places in the editor where this value is displayed 'as is' with decimals, which is incorrect; For example, the timezone component and the post-schedule label:
Instead of 5.75
it should be 5:45
.
WordPress core handles this case in a couple places with a simple string manipulation, so to have an appropriate value to be displayed. See the select for the timezone setting and in the customizer.
Instead, Gutenberg displays the value 'as is'.
Proposed solution
At first, I tried to fix this 'locally' in the components but then I realized it would be best to fix it in the Date settings. Adding a 'display value' there would be best, so that it is available everywhere and can be used where necessary.
The relevant data are set via wp.date.setSettings()
in the script loader here and then retrieved via wp.date.getSettings()
.
This would require a change in WP core and a compat file.
Step-by-step reproduction instructions
- Go to the WordPress admin Settings > General Settings > Timezone.
- Set the Timezone value to
UTC+5:45
and save. - Go to the post editor and publish a new post.
- Click the Publish date in the settings panel.
- Observe that both the Publish date and the timezone indication in the Publish popover display
UTC+5.75
. - Expected:
UTC+5:45
Screenshots, screen recording, code snippet
No response
Environment info
No response
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes