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

Record timestamp creation refactored #1149

Merged
merged 1 commit into from
Jul 28, 2020
Merged

Record timestamp creation refactored #1149

merged 1 commit into from
Jul 28, 2020

Conversation

kidunot89
Copy link
Contributor

Fixes #1140

Summary

This replaces the usage of wp_stream_get_iso_8601_extended_date() for creating record timestamp with current_time()

@kidunot89 kidunot89 requested review from kasparsd and kopepasah July 28, 2020 15:35
@kidunot89 kidunot89 self-assigned this Jul 28, 2020
Copy link
Contributor

@kasparsd kasparsd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@@ -138,7 +135,7 @@ function ( $var ) {
'blog_id' => (int) apply_filters( 'wp_stream_blog_id_logged', get_current_blog_id() ),
'user_id' => (int) $user_id,
'user_role' => (string) $role,
'created' => (string) $iso_8601_extended_date,
'created' => (string) current_time( 'mysql', true ),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We always need the UTC timestamp formatted for the DATETIME field in the DB so this will ensure we always get that consistent value.

This is different from the current behaviour of wp_stream_get_iso_8601_extended_date() which always adds the timezone information:

return $date->format( 'Y-m-d\TH:i:sO' );

which was probably causing the bug as the MySQL client wasn't able to cast it to a valid DATETIME value.

@kasparsd kasparsd merged commit 93201bd into develop Jul 28, 2020
@kasparsd kasparsd deleted the bugfix/date-bug-2 branch July 28, 2020 15:52
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

Successfully merging this pull request may close these issues.

Stream Records dates are 2052 years ago with zeroed 'created' fields in database
2 participants