stream icon indicating copy to clipboard operation
stream copied to clipboard

Date filtering is off by one day

Open ashicus opened this issue 4 years ago • 4 comments

Bug Report

Expected Behavior

When filtering logs by date, the returned results should be for the selected date.

Actual Behavior

When filtering logs by date, the returned results are from one day AFTER the selected date.

Steps to Reproduce the Problem

  1. Log out, and then log back in to WordPress (to generate some fresh records)

  2. Filter records by "Today" and see that the login events from Step 1 are NOT shown.

  3. Filter records by "Yesterday" and see that the login events from Step 1 ARE shown.

Screenshots

Screen Shot 2020-06-24 at 12 15 53 PM Screen Shot 2020-06-24 at 12 16 36 PM Screen Shot 2020-06-24 at 12 14 07 PM

System Information

  • Stream plugin version: 3.4.3
  • WordPress version: 5.4.2
  • PHP version: 7.3.19
  • Browser: Chrome 83
  • Computer operating system: macOS 10.15.4

ashicus avatar Jun 24 '20 16:06 ashicus

@ashicus Could you reconfirm this issue? While I was able to recreate the issue days ago. When I returned to it to day, I wasn't able to recreate the issue.

kidunot89 avatar Jun 29 '20 22:06 kidunot89

@kidunot89 I retested on several different sites, and I am only able to recreate it on the site that I was using when I first reported the issue.

On this site, even if I disable all other plugins and switch to the TwentyTwenty theme, it still happens both locally and on a remote server. The only thing that's "different" about this site is that it's running on the roots.io stack (Bedrock and Sage, but not Trellis), so my best guess is that it has something to do with that?

ashicus avatar Jun 30 '20 15:06 ashicus

@ashicus Could you please confirm the server/PHP timezone and the WP timezone of the site where you're seeing this? I wasn't able to replicate this on the site I have Stream installed.

kasparsd avatar Jul 07 '20 16:07 kasparsd

@kasparsd Apologies for the slow response.

I played around with the timezones and I might have a lead.

On the site I'm testing with, the server time is UTC, and WP is set to New York (UTC-4). But even though it's still "today" in both of those timezones, log entries don't show up in the list when I select the "Today" filter. If I switch WP to UTC, it fixes the issue. Interestingly, I get the same results when I do the same test in my local version of the same site, where the WP and system timezones match – I need to switch WP to UTC to make it work locally.

So then I ran the same test on a fresh roots.io install (sans Trellis), as well as a vanilla WP install. All had the same results – the Stream date filtering is off, unless WP is set to UTC.

ashicus avatar Jul 20 '20 17:07 ashicus