Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

date_format="relative" is relative to UTC not site current time. #233

Open
shazahm1 opened this issue Dec 31, 2019 · 1 comment
Open

date_format="relative" is relative to UTC not site current time. #233

shazahm1 opened this issue Dec 31, 2019 · 1 comment

Comments

@shazahm1
Copy link
Contributor

Line 824 which is currently:

return human_time_diff( $date ) . ' ' . __( 'ago', 'display-posts' );

needs to be:

return human_time_diff( $date, current_time( 'timestamp' ) ) . ' ' . __( 'ago', 'display-posts' );

Otherwise the relative time returned is against the server time() usually set to UTC so the displayed relative time is not correct.

It should be relative against the current time for the site which if offset to the timezone set by the user in there settings.

I hope I have explained this clearly!

@thesunshade
Copy link

I can confirm that this fix works. Now displaying relative to my website's time zone.

Any chance this could get updated? I have no idea how to do a pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants