Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#47463 closed enhancement (fixed)

Refactor from using invalid timestamps in event filtering

Reported by: rarst's profile Rarst Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 5.3 Priority: low
Severity: minor Version:
Component: Date/Time Keywords: has-patch
Focuses: Cc:

Description

Event API sends WordCamp and Meetup data with date/time lacking time zone information (see https://meta.trac.wordpress.org/ticket/4480 )

The current implementation of filtering for upcoming events tries to parse that into timestamps (which doesn't really work) and determine upcoming events by comparing against "WP timestamp" summed with time zone offset (which isn't really appropriate for the task, or ever).

Patch simplifies the logic to date comparison and removes reliance on WP timestamp.

Parent issue #40657

Attachments (1)

trim-events.patch (1.2 KB) - added by Rarst 5 years ago.

Download all attachments as: .zip

Change History (4)

@Rarst
5 years ago

#1 @Rarst
5 years ago

  • Summary changed from Refactor from using invalid timestamps in event filtreing to Refactor from using invalid timestamps in event filtering

#2 @SergeyBiryukov
5 years ago

  • Milestone changed from Awaiting Review to 5.3
  • Owner set to SergeyBiryukov
  • Status changed from new to reviewing

#3 @SergeyBiryukov
5 years ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In 45886:

Date/Time: Simplify the date comparing logic in WP_Community_Events::trim_events().

The Events API returns event date without timezone information, so trying to parse it into a timestamp and compare to a WP timestamp is pointless.

Props Rarst.
Fixes #47463.

Note: See TracTickets for help on using tickets.