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

Dashboard widget shows wrong date #166

Closed
Zodiac1978 opened this issue Jul 3, 2020 · 0 comments · Fixed by #167
Closed

Dashboard widget shows wrong date #166

Zodiac1978 opened this issue Jul 3, 2020 · 0 comments · Fixed by #167

Comments

@Zodiac1978
Copy link
Member

First reported here: https://wordpress.org/support/topic/date-one-day-behind-in-dashboard/

The dashboard shows for today the date of yesterday. It looks like this is a problem with date_i18n which is just a legacy wrapper for wp_date since WP 5.3.

The user tested it with
date_i18n( get_option( ‘date_format’ ), strtotime( $visit[‘date’] ) );

Which shows the wrong date. And:

wp_date( get_option( ‘date_format’ ), strtotime( $visit[‘date’] ) );

Which shows the correct date (for the site with the problem and a site without the problem).

See also:
https://developer.wordpress.org/reference/functions/date_i18n/
https://developer.wordpress.org/reference/functions/wp_date/
https://make.wordpress.org/core/2019/09/23/date-time-improvements-wp-5-3/

Function is used here:
https://github.com/pluginkollektiv/statify/blob/master/views/widget-front.php#L25
and here:
https://github.com/pluginkollektiv/statify/blob/master/views/widget-front.php#L108

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

Successfully merging a pull request may close this issue.

2 participants