Opened 4 weeks ago
Last modified 2 weeks ago
#62400 assigned defect (bug)
RSS Block showing date in UTC when pubDate in feed is not
Reported by: | kaitohm | Owned by: | pbearne |
---|---|---|---|
Milestone: | 6.8 | Priority: | normal |
Severity: | normal | Version: | 6.7 |
Component: | Date/Time | Keywords: | has-testing-info gutenberg-merge has-patch |
Focuses: | Cc: |
Description
Originally reported in this Japanese support thread.
To reproduce:
- Change the site timezone to something other than UTC+0. (Example:
UTC+9
) - Include an RSS Block to any post.
- Add a link to an RSS feed where the
pubDate
item is not in GMT/UTC. (Example: https://www.mixonline.jp/DesktopModules/MixOnline_Rss/MixOnlinerss.aspx?rssmode=3 wherepubDate
has a+0900
offset.) - In block settings, turn on
Display date
. - Both in the editor and the published post, the date will be shown in UTC. (Example: An article with
<pubDate>Wed, 13 Nov 2024 04:52:00 +0900</pubDate>
in the feed will be shownNovember 12, 2024
. With the site timezone set to UTC+9, I would expect this to sayNovember 13, 2024
)
Things I've tested:
- I've reproduced the forum ticket submitter's issue on WordPress 6.7.
- Changing the language in site settings doesn't have any effect.
- Testing with a different RSS feed gave the same results (https://www.nhk.or.jp/rss/news/cat1.xml).
- Plugin https://wordpress.org/plugins/wp-rss-aggregator/ and external RSS reader https://www.inoreader.com showed the intended date (November 13th) when using the same feed. So, the issue doesn't seem to be with the feed.
Change History (16)
#2
@
4 weeks ago
Hi @kaitohm
I have tried to replicate this issue and I am able to replicate this at my end too.
Environment
WordPress: 6.7-beta1-59152-src
PHP: 8.3.7
Server: nginx/1.25.4
Database: mysqli (Server: 8.3.0 / Client: mysqlnd 8.3.7)
Browser: Chrome 125.0.0.0
OS: macOS
Theme: Twenty Twenty-One Version 2.2
MU Plugins: None activated
Plugins:
Related File : packages/block-library/src/rss/index.php line no. 53,54
Also it looks like this is happening because we are using date_i18n() function in WordPress formats a date according to the locale and the settings defined in WordPress, but it does not automatically adjust the time according to the timezone set in WordPress settings (Settings > General > Timezone). It relies on the get_option( 'timezone_string' ) or get_option( 'gmt_offset' ) to determine the correct time zone. However, the date_i18n() function formats the date based on the server time (which could be in UTC or any other server timezone) unless you explicitly adjust for timezones.
#4
follow-up:
↓ 7
@
4 weeks ago
Hey @kaitohm,
As this issue is related to Gutenberg, I’ve opened a issue in the Gutenberg repository for further review.
You can track the progress here: https://github.com/WordPress/gutenberg/issues/66970
This ticket was mentioned in Slack in #core-test by oglekler. View the logs.
4 weeks ago
#6
@
4 weeks ago
- Keywords gutenberg-merge added
@kirasong please check this as as a candidate to 6.7.1. release.
#7
in reply to:
↑ 4
@
4 weeks ago
Replying to sainathpoojary:
Hey @kaitohm,
As this issue is related to Gutenberg, I’ve opened a issue in the Gutenberg repository for further review.
You can track the progress here: https://github.com/WordPress/gutenberg/issues/66970
Thanks!
#8
@
4 weeks ago
Already replied on the Gutenberg issue, but the same problem probably affects the legacy RSS widget - https://github.com/WordPress/wordpress-develop/blob/a27e6a8ecd5279a45e47ef88d048643740d07b5a/src/wp-includes/widgets.php#L1654-L1660.
@kaitohm, can you clarify the expected behavior in the description?
I expect that the RSS block/widget will display dates in the format specified in WP, but the date will be in the origins timezone. Unless I'm missing something, the publishing date shouldn't be relative to the WP configuration.
#9
@
4 weeks ago
@kaitohm, can you clarify the expected behavior in the description?
@Mamaduka Did you mean here in Trac, or in the GitHub issue?
Currently, if the feed says <pubDate>Wed, 13 Nov 2024 04:00:00 +0900</pubDate>
, then regardless of site timezone, the block shows November 12th
.
What should happen is, if the feed says <pubDate>Wed, 13 Nov 2024 04:00:00 +0900</pubDate>
, then
- if the site timezone is set to UTC+5, UTC+6, UTC+7..., then the block should show
November 13th
. - if the site timezone is set to UTC+4, UTC+3, UTC+2..., then the block should show
November 12th
.
As another example, if the feed says <pubDate>Wed, 13 Nov 2024 04:00:00 GMT</pubDate>
, then
- if the site timezone is set to UTC-4, UTC-3, UTC-2..., then the block should show
November 13th
. - if the site timezone is set to UTC-5, UTC-6, UTC-7..., then the block should show
November 12th
.
#10
follow-up:
↓ 12
@
4 weeks ago
Thank you, @kaitohm!
Either place is fine. We'll also need to apply the fix to the legacy RSS widget.
This ticket was mentioned in PR #7798 on WordPress/wordpress-develop by @narenin.
4 weeks ago
#11
- Keywords has-patch added
Trac ticket: https://core.trac.wordpress.org/ticket/62400
#12
in reply to:
↑ 10
@
4 weeks ago
Replying to Mamaduka:
Thank you, @kaitohm!
Either place is fine. We'll also need to apply the fix to the legacy RSS widget.
My pleasure! :-)
Hi @kaitohm,
Welcome to Trac, and thank you for opening this ticket!
I’ve confirmed that I could reproduce the issue on WordPress version 6.7. There seems to be an inconsistency in the date between the editor/front end, and the feed data.
Thanks again for bringing this to attention!