Make WordPress Core

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#48625 closed defect (bug) (invalid)

The post publish time in wp-admin/post.php appears in UTC

Reported by: biranit's profile Biranit Owned by:
Milestone: Priority: normal
Severity: normal Version: 5.3
Component: Date/Time Keywords: close
Focuses: administration Cc:

Description

Hi,

After upgrading to WordPress 5.3, the time shown inside <span id="timestamp"> for a published post, is displayed in UTC. Our website's timezone is UTC+2, the server's timezone as well as the PHP ini timezeon is Asia/Jerusalem. Despite this, a post published at 08:00 shows on wp-admin/post.php as having been published at 06:00.

This is only the case for wp-admin/post.php -- in the list of posts, the "time ago" is correct. The time is also correct in RSS feeds, on the post page (frontend), etc.

Thanks,

Bira

Change History (10)

#1 @SergeyBiryukov
5 years ago

Might be related: #48384

#2 @Rarst
5 years ago

I don't think I understand exact place you are talking about.

Are you using Classic Editor? Screenshot might be helpful, if not too much trouble. :)

#4 @SergeyBiryukov
5 years ago

  • Version set to 5.3

#5 @Biranit
5 years ago

I am using the classic editor (I have "disable guttenberg" installed).

https://static.zman.co.il/www/uploads/datetime-bug.png

The above post was published at 06:38 (UTC+2)...

Last edited 5 years ago by Biranit (previous) (diff)

#6 follow-up: @Rarst
5 years ago

This plugin to be clear https://wordpress.org/plugins/disable-gutenberg/ ?

I cannot reproduce locally, the time displays correctly for me...

  1. Does this happen on every post or just some posts?
  2. Could you look up what's the post_date is in database for post you used as example?
  3. You mentioned that you set Jerusalem timezone in PHP, any chance you are trying to do this during WP operation as well? WP core resets PHP time zone on boot to UTC and relies on that assumption (we are working to making it more robust, but we are not there 100% yet).
Last edited 5 years ago by Rarst (previous) (diff)

This ticket was mentioned in Slack in #forums by joyously. View the logs.


5 years ago

#8 in reply to: ↑ 6 @Biranit
5 years ago

  • Keywords close added
  • Resolution set to invalid
  • Status changed from new to closed

Replying to Rarst:

This plugin to be clear https://wordpress.org/plugins/disable-gutenberg/ ?

I cannot reproduce locally, the time displays correctly for me...

  1. Does this happen on every post or just some posts?
  2. Could you look up what's the post_date is in database for post you used as example?
  3. You mentioned that you set Jerusalem timezone in PHP, any chance you are trying to do this during WP operation as well? WP core resets PHP time zone on boot to UTC and relies on that assumption (we are working to making it more robust, but we are not there 100% yet).

OK, your questions made me go detective a little more - and you are right, there was a date_default_timezone_set('Asia/Jerusalem') in our global functions...

I am very sorry to have bothered you all. I removed this line and it seems everything is working correctly now. My apologies.

#9 @Rarst
5 years ago

No worries. It's a typical problem and we are working on making it less of a problem by separating core code from assumption of UTC time zone. 5.3 actually greatly improves how that is handled.

#10 @SergeyBiryukov
5 years ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.